27 May, 2011

vim editor string manipulation, replace string

Every occurrence in file
:%s/<OLD STRING>/<NEW STRING>/g

Change <OLD STRING> to <NEW STRING>, but ask for confirmation first.

:%s/<OLD STRING>/<NEW STRING>/gc


change string between a particular line number
:123,567s/<OLD STRING>/<NEW STRING>/gc

No comments:

Post a Comment