[Cialug] vim global replace

Josh More morej at alliancetechnologies.net
Fri Sep 18 10:03:59 CDT 2009


g is global for the line only.

If you want it to impact all lines, you want to use:

:%s/^/'/g
 



-Josh More, RHCE, CISSP, NCLP, GIAC 
 morej at alliancetechnologies.net 
 515-245-7701



>>> Todd Walton <tdwalton at gmail.com> 9/18/2009 10:02 AM >>> 
I'm using vim in cygwin.

$ vi --version tells me:
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Oct  9 2008 15:23:22)

I've opened a text file and ran:

:s/^/'/g

It only puts a ' on the first line and then stops.  Pushing n tells me
"E35: No previous regular expression".  Pushing & puts another ' on
the first line.

Anybody know what gives?  Ultimately, my goal is to put a pair of '
around the contents of each line.  It's a list of serial numbers.

--
Todd
_______________________________________________
Cialug mailing list
Cialug at cialug.org
http://cialug.org/mailman/listinfo/cialug



More information about the Cialug mailing list