If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
I want to substitute the $1 parameter in a script that executes sed, but I cannot get the substitution to work. I can only get SOOOO close. Here is my script so far:
sed -e 's/foo/$1/g' <infile.nam >outfile.nam
assuming that the above command is in a script called swapme, then typing:
>swapme bar
I want every occurance of "foo" in file infile.nam changed to "bar" in file outfile.nam.
What I get is every occurance of "foo" in file infile.nam changed to "$1" in file outfile.nam. The $1 substitution does not "take" and so the literal characters $1 are what gets passed to sed. sed does what it's told to do.
What do I need to do to make the $1 get replaced with "bar"?