Vi search and replace

Joachim Backes joachim.backes at rhrk.uni-kl.de
Tue Oct 17 13:52:36 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?
> 

For example:

:1,$s!/!!g

is the same as

:1,$s/\//g

removes all / chars in all lines (you can use another search pattern delimiter instead of "/" - 
this is "!" here). In this way, escaping is not needed.

-- 
Joachim Backes <joachim.backes at rhrk.uni-kl.de>
University of Kaiserslautern,Computer Center [RHRK],
Systems and Operations, High Performance Computing,
D-67653 Kaiserslautern, PO Box 3049, Germany
--------------------------------------------------
Phone: +49-631-205-2438, FAX: +49-631-205-3056
http://hlrwm.rhrk.uni-kl.de/home/staff/backes.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5184 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.fedoraproject.org/pipermail/users/attachments/20061017/81b6d1e5/attachment-0002.bin 


More information about the users mailing list