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

what is the cmd to display the last exit status in UNIX?

5 Answers   MEIT, Syntel,


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

4 Answers  


what is telnet?

6 Answers  


Which mode is used for allowing file write,read and append mode?

9 Answers   BitWise, TM,


in a growing log file how will you see the 1st 99 lines?

7 Answers  






What are reported commands?

0 Answers  


What is the command to check ports active in UNIX?

4 Answers   Accenture, IBM,


What is the protocol for PING command?

1 Answers   IBM,


Will rm -r* removes hidden files?

10 Answers  


Give Command that will move a single file called "unix.txt"

7 Answers   IBM,


what is mount ,tell me about mount ,how can u use in real time project??

12 Answers   Symphony,


How can we "forked" process in UNIX? How then recognize in any of the branches we?

2 Answers   NIIT,


Categories