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

Pratik Vyas m at pd.io
Sun Jan 26 05:37:39 EST 2014


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 INSERT command and append ; 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. 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


More information about the Linuxers mailing list