changing multiple things on one line in vi

Randy Melder randymelder at gmail.com
Fri Aug 19 15:18:41 MST 2005


Simply place the cursor on the line that needs multiple replacements and...
:s/images/pictures/g

notice, there's no % ... that limites it to the current line only.

:s/son.gif/daughter.gif/g

:s/original/replace/g

Hope this helps!

; ) .randy


On 8/19/05, Matt Alexander <lowbassman at gmail.com> wrote:
> MCR wrote:
> 
> >This is along the line of a couple of posts today, so
> >I thought I would finally ask.  When I have a document
> >open in vi, sometimes I would like to do a change and
> >have it apply to only one line, I know how to do it
> >globally, but I can not seem to find out how to do it
> >for just the one line.  Example:
> >For global: say I have a html document and my image
> >directory is named "images".  I decide to change the
> >name of the directory to pictures, I know to do this
> >for the whole document I do:
> >:%s/images/pictures/g
> >
> >
> >
> 
> Instead of %s, use just the line number you want to edit.  So, to change
> only line 34...
> 
> :34s/images/pictures/g
> 
> 
> 
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change  you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
> 


-- 

..::Randy Melder::..
http://www.spininternetmedia.com


More information about the PLUG-discuss mailing list