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

Enumerate some of the most commonly used network commands in unix?

0 Answers  


What is the difference between AWK and SED commands? Plz give example and explain...

3 Answers   RBS,


How to find the files that are accessed before 10 minutes?

5 Answers   Amazon,


What is a bash command?

0 Answers  


in UNIX,what is the command to remove directory with files?

10 Answers  






what is the command to get help on a UNIX terminal?

5 Answers  


what does a process mean?

7 Answers   Infosys,


How do I search a whole word in vim?

0 Answers  


Explain how to use grep command to list find the records of a file containing 10 different strings?

0 Answers  


What command is used to replace the existing string with some other?

8 Answers   TCS,


How do I run a whois command?

0 Answers  


What is file system in unix??

10 Answers   Symphony,


Categories