Help needed on substitution in Unix (sed)

Status
Not open for further replies.

raksrules

Youngling
I am using the following command in my UNIX code

Code:
sed "s/$FIND/$REPLACE/g" $IMP_RECORD_CTL > c.ctl
This command replaces all instances of $FIND with $REPLACE. These two variables contain some data and it operates on data contained in variable $IMP_RECORD_CTL and stores the result in file named c.ctl

Now after this i am using the following command

Code:
cat c.ctl | sed "s/POSITION FILLER/POSITION CONSTANT/g" > d.ctl
Here i am opening the file c.ctl (created above) and passing its contents to the sed command which will replace all instances of string "POSITION FILLER" with "POSITION CONSTANT" and put the contents in d.ctl

Now i want to effectively do both of these substitutions in the same file using a single command ( or something similar) . How can i achieve this ?

I mean i dont want to first substitute and put data in file c.ctl and then again substitute and put in d.ctl
 

Faun

Wahahaha~!
Staff member
lolz I may be silly but do you want it on single line or altogether different command ?
 
Status
Not open for further replies.
Top Bottom