How would you change all occurrences of a value using VI?

Answers were Sorted based on User's Feedback



How would you change all occurrences of a value using VI?..

Answer / sridhar

press esc+shift
then when the VI takes u to the edit mode use the following.

:%s/pattern/new value/g

Is This Answer Correct ?    13 Yes 0 No

How would you change all occurrences of a value using VI?..

Answer / sameer

press esc+shift
then when the VI takes u to the edit mode use the following.

:1,$s/pattern to be changed/new value/g

Is This Answer Correct ?    9 Yes 0 No

How would you change all occurrences of a value using VI?..

Answer / dinesh

:%s/pattern/new value/g

Is This Answer Correct ?    6 Yes 0 No

How would you change all occurrences of a value using VI?..

Answer / chitra

One should be in command mode for doing this.(i.e press esc)
:%s/oldpattern/newpattern and press enter

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More Unix Commands Interview Questions

Why is it called grep?

0 Answers  


solaris Run level?

3 Answers   Wipro,


What is the use of tee command?

0 Answers  


How do I find previous commands in unix?

0 Answers  


Which command should you use to find the remaining disk space in unix server?

0 Answers  


Is there any command in Unix, other than:ls, to list the files in a directory? The answer will be highly appreciated...

27 Answers   CGI,


What is command substitution?

0 Answers  


Differentiate cmp command from diff command.

0 Answers  


What is a command and examples?

0 Answers  


In UNIX, what is the command to kill a process?

10 Answers  


What does this command do? Cat food 1 > kitty

0 Answers  


What is pid?

4 Answers  


Categories