Thursday, January 22, 2009

string replacement

Sometimes you want to replace one string with another. This is done with the ex command "s". The form of the replacement is :

: line_range s/old/new/g
ex ( replace foo with bar from line 10 to 20 ) :
:10,20s/foo/bar/g
You can use visual mode to select the lines, when you type the colon to start the command it will use symbols for the visual line range.

No comments: