[ILUG-BOM] [OT] Help on Vi Command

Joel A Divekar joel_divekar at rediffmail.com
Sun Jan 26 06:09:02 EST 2014


Thanks a lot Pratik.

From: Pratik Vyas <m at pd.io>
Sent: Sun, 26 Jan 2014 16:08:24 
To: "GNU/Linux Users Group, Mumbai, India" <linuxers at mm.ilug-bom.org.in>
Subject: Re: [ILUG-BOM] [OT] Help on Vi Command
Hi Joel,





On Sun, Jan 26, 2014 at 3:57 PM, Joel A Divekar

<joel_divekar at rediffmail.com> wrote:

>

> Hi All

> I am trying to do the following

> Search for all lines starting with&nbsp;INSERT&nbsp;command and append ;&nbsp;at End of Line

>

> I am aware about search and replace using

> :%s/^INSERT/$;/g

> but this replaces INSERT and not append ; at end of the line.&nbsp;Kindly help

> Regards

>



Try,

:%s/^INSERT\(.*\)$/\0\&nbsp\;/g



ie. Capture everything after the INSERT and replace it by itself (\0)

and the text you want you append.

>

> Joel Divekar

> --

> http://mm.ilug-bom.org.in/mailman/listinfo/linuxers



Thanks.

Pratik

-- 

http://mm.ilug-bom.org.in/mailman/listinfo/linuxers



More information about the Linuxers mailing list