How to replace String "a" with String "b" in whole file of
the vi editor?
Answers were Sorted based on User's Feedback
Answer / debjyoti mukherjee
:g/string1/s//string2/g
ex:
:g/a/s//b/g
Is This Answer Correct ? | 45 Yes | 15 No |
Answer / kasani
:%s/a/b/g
where a is old string
b is new string
Is This Answer Correct ? | 22 Yes | 3 No |
Answer / jp
The answer given by Mukesh would only change the first word
in each line.
So change has to be global... so add /g to it.
Is This Answer Correct ? | 8 Yes | 2 No |
Answer / deepti
current path= /a/b/c/ -- new path= /e/f/
:%s/a\/b\/c/e\/f
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / nikhil vasishta
try this.
current path= /a/b/c/ -- new path= /e/f/
:%s/a\/b\/c\//e\/f\//g
where g = global (wherever the current path comes it will
change it to new path).
Is This Answer Correct ? | 4 Yes | 7 No |
what are the different delete commands used in vi editor?
What is the difference between lettered buffer and temporary buffer?
How to replace String "a" with String "b" in whole file of the vi editor?
What is the command used to display line numbers in vi editor?
what is the command used to append text after current line?
How to return to shell without leaving vi editor?
what is the command used to append to buffer?
How to append a file to current file?
what are the different commands used to quit from the vi editor?
what does the c$ command do from command mode?
HOW WE CAN MAKE THE DLIEVERY WHICH IS BLOCKED DUE TO CREDIT LIMIT.
Which command is used to replace many characters?