top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Is there any way to replace a string with another in a file using "vi" or "vim" editor?

–1 vote
861 views

I have a large file which has "some string"so many times, i want it to be replaced with "other string" at all places, using vi or vim editor?
Is there any way to do that?

posted May 13, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

+2 votes

Use below syntax

:%s/somestring/otherstring/g

answer May 13, 2016 by Bhaskar Kalaria
0 votes

vi (vim) is not difficult to learn, the vi editor is well known and used for both writing code and editing config files.

answer May 14, 2016 by Kapil Kumar
0 votes

Use below syntacx to replace the string with another string in VIM Editor

:%s///gc

"C" it will ask for confrimation whether to replace or not.
"g" used to replace.

answer May 16, 2016 by Manohar Venkat.ch
Similar Questions
+1 vote

I have a Linux machine and windows machine, I need to run a GUI of Linux machine on the windows machine.
I don't want to use putty or any other software. I have to use any Perl modules to achieve this please help.

...