Vi search and replace

Phil Meyer pmeyer at themeyerfarm.com
Tue Oct 17 14:10:42 UTC 2006


Phil wrote:
> Hello,
>
> I am trying to do a search and replace in vi but I need to search and 
> replace on "/T"
>
> so how do I escape the /?
>
> %s/"/T"/T/g obvisouly does not work....
>
> how do I specify a / in the vi search string?
One method not yet mentioned, is to use the ? character as the separator 
when performing functions against the / character:

:g?/T?s??/Tommy?g

means: search and replace all occurrences of /T with /Tommy

Forgive my old regex style. :)




More information about the fedora-list mailing list