how to escape special characters like in sed

April 17, 2011 at 23:29:09
Specs: Windows XP
my original file contains

echo 123245 >

i want the output file like

#echo 12345 >

i am using syntax
sed -i 's/echo 12345 \>/#echo 12345 \>'1.txt

but i m getting error
sed: -e expression #1, char 24: unknown option to `s'

pls help


See More: how to escape special characters like in sed

Report •

#1
April 18, 2011 at 06:56:32
I'm not near a Linux maching, but this should work:

sed 's&echo 12345 >&#echo 12345 >&g' 1.txt

I changed the sed default delimiter to &


Report •

#2
April 20, 2011 at 01:29:53
changing the delimiter is the nicest way. You could also use a \ in front of the #, just like with the > character.


Report •
Related Solutions


Ask Question