Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Nov 1998 18:43:07 -0700
From:      "Mark J. Sommer" <msommer@argotsoft.com>
To:        questions@FreeBSD.ORG
Subject:   Re: "vi" problem with search & replace (vi do not accept "/").
Message-ID:  <3.0.3.32.19981124184307.00973b40@mail>

next in thread | raw e-mail | index | archive | help
At 03:26 PM 11/24/98 -0800, you wrote:
>>Date: Tue, 24 Nov 1998 18:23:45 -0500
>>From: Malartre <malartre@aei.ca>
>
>>This is not FreeBSD specific, but I guess someone could give me the
>>trick:
>>I want to "search & replace" the sentence "</TT></B></FONT>" with
>>"<</COMMAND>>".
>
>>:%s/</TT></B></FONT>/<</COMMAND>>/g
>
>>But that give me an error (has I expected, because of the "/" in those
>>HTML tags.
>
>You need to "escape" the /:
>
>:%s/<\/TT><\/B><\/FONT>/<<\/COMMAND>>/g
>
>>Well, I don't know how to type a "/" without interfering with vi's /.
>
>It is common (in UNIX) to use \ as an "escape" mechanism.

Better yet, since typing \/ is a pain, just use

:%s:</TT></B></FONT>:<</COMMAND>>:g

The substitute command will use the first char as the delimeter.

~Mark
----------------------
msommer@argotsoft.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.3.32.19981124184307.00973b40>