Friday, April 06, 2007

Find and replace with VI

this will replace all occurrences of match_pattern in the file

:g/match_pattern/s//replace_string/g
alternatively, you can use ' : ' instead of ' / ' to make path (/) slashes easier to manage (no escape (\) character needed)
:g:match_pattern:s::replace_string:g

No comments:

Post a Comment