Home > Technical, unix commands > Replace a string in VIM

Replace a string in VIM

January 4, 2012

Replace in the entire file:

——————————

Open Vi Editor, Press Esc

then type :s/string/replacestring/ press enter

Ex:

:s/karu/nand/ press enter

Replace with in some lines:

———————————-

:linefrom,linetos/string/replacestring/ press enter

Ex:

1,10s/karu/nand/ press enter

Advertisements
Categories: Technical, unix commands
%d bloggers like this: