Originally Posted by ktr944
I want to replace a string in a file. The string is:
$var 1>&2 >> /dev/null &
#$var 1>&2 >> /dev/null &.
Appreciate any help.
Normally, I'd suggest the man page for sed....but cripes, that's one heck of a man page. There are lots of good articles about sed via Google, and it's very powerful...try:
Note the '\'....for sed, you'll probably have to 'escape' the special characters (stuff like #!&, etc.), to make sed treat them as just 'regular' characters....the 's' is for substitute, and the 'g' tells sed to replace ALL occurrences. If you omit the 'g', it'll just do the first one.