Oliver's Tips'n'Tricks
From Wikiid
Revision as of 19:13, 23 October 2007 by SteveBaker (Talk | contribs) (New page: =="vi" commands== Bulk substitution of text: :1,$s/oldtext/newtext/g The ':' puts you into commandline mode, the 's' means 'substitute'. If either oldtext or newtext contains a slash t...)
"vi" commands
Bulk substitution of text:
:1,$s/oldtext/newtext/g
The ':' puts you into commandline mode, the 's' means 'substitute'. If either oldtext or newtext contains a slash then you can use some other character instead, eg:
:1,$s!oldtext!newtext!g
...the 'g' at the end means "change every occurrance on the line" - if you leave it off, it'll replace only the first occurrance of 'oldtext' on each line. The '1,$' part means "from line one to the last line in the file", you could alternatively say '10,20' or something.\