Click to See Complete Forum and Search --> : hopefully easy


crokett
06-29-2001, 03:51 PM
i need to search for " /255" in a file and replace with "/255"
i have tried piping cat to sed and using:

sed s/" \/255"/\/255/
sed s/ \/255/\/255/
sed s/" /255"//255/
sed s/ /255//255/

none of the above works. i checked man pages and a half a dozen sed tutorials online, none was any help. man pages said something about \cregexprc where c is any char, but that did not work.

thanks

mis
06-29-2001, 04:17 PM
Originally posted by crokett:
<STRONG>i need to search for " /255" in a file and replace with "/255"
i have tried piping cat to sed and using:

sed s/" \/255"/\/255/
sed s/ \/255/\/255/
sed s/" /255"//255/
sed s/ /255//255/

none of the above works. i checked man pages and a half a dozen sed tutorials online, none was any help. man pages said something about \cregexprc where c is any char, but that did not work.

thanks</STRONG>


I suggest using vi instead

vi the file
at the : do this
:1,$s/wordtoreplace/wordtoreplacewith/g

This will change all occurances of that word in the file.

[ 29 June 2001: Message edited by: mis ]

crokett
06-29-2001, 04:56 PM
what about special chars such as / will vi handle those? that is what i couldn't figure out with sed.

thanks,