Help, Vi gurus!

MSAgent

Member
May 8, 2001
87
0
0
fellows, how do I replace a word that has '/' in it? the command goes like this :%4/old/new/g as you have already known.


I struggled with it for a while but could not find the answer, and would appreciated it if anyone can help me out here.
 

Spydermag68

Platinum Member
Apr 5, 2002
2,616
99
91
I have not used UNIX for a while but I think you need to use the escape chracter \ just before the /

So try: %sed "s/old\/old/new/g" filename
 

PCHPlayer

Golden Member
Oct 9, 2001
1,053
0
0
VI actually lets you specify the delimiter character. I tend to use a ' (single quote) when my strings have a / in them.
Example: %s'old'new'g