Help needed on substitution in Unix (sed) [message #357762] |
Thu, 06 November 2008 08:28 |
rak007
Messages: 107 Registered: October 2006 Location: Mumbai / Pune, India
|
Senior Member |
|
|
I am using the following command in my UNIX 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
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
|
|
|
|
|
|