[plug] re: replacing text in search

Steve Baker steve at iinet.net.au
Sat Aug 2 12:23:23 WST 2003


Jon Miller wrote:

> In vim how do I do a search and replace for the following
> /sbin/iptables?  I've tried %s//sbin/iptables/g but this does not work. 
> I'm need to include the / character in the search.
> 
> Thanks

Put a \ before the / to escape it in the search string, ie: 
%s/\/sbin\/iptables/otherstring/g.

Some versions of vi (don't know if this includes vim) also allow 
different characters instead of / as a delimeter, so try 
%s:/sbin/iptables:otherstring:g as well.

bakes



More information about the plug mailing list