Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to replace the exact word in vi editor??
suppose a file contains words like amaze,amazed,amazement in
some of the line.But i want to replace only 'amaze' with
delight but don't wanna replace amazed or amazement.
thanks

Answers were Sorted based on User's Feedback



How to replace the exact word in vi editor?? suppose a file contains words like amaze,amazed,amazem..

Answer / shilpi gupta

sed 's/\<amaze\>/delight/g' file_name

or

In Vi editor..you can use

:%s/\<amaze\>/delight/g

Is This Answer Correct ?    7 Yes 0 No

How to replace the exact word in vi editor?? suppose a file contains words like amaze,amazed,amazem..

Answer / chandra babu.p

s/string/string/g;
ex;

:s/unix/linux/g

Is This Answer Correct ?    5 Yes 2 No

How to replace the exact word in vi editor?? suppose a file contains words like amaze,amazed,amazem..

Answer / majeed

First open the file by using vi editor and then

use this :%s /amaze/delight/g

Is This Answer Correct ?    3 Yes 2 No

How to replace the exact word in vi editor?? suppose a file contains words like amaze,amazed,amazem..

Answer / supreet goswami

sed-i "s| amaze |delight|g" filename

Is This Answer Correct ?    0 Yes 0 No

How to replace the exact word in vi editor?? suppose a file contains words like amaze,amazed,amazem..

Answer / kranthi kumar

:1,$s/amaze$/amazing/g

this will be changed only amaze in totalvi editor....

Is This Answer Correct ?    2 Yes 3 No

How to replace the exact word in vi editor?? suppose a file contains words like amaze,amazed,amazem..

Answer / ahmed

sed 's/amaze/amazing/g' filename.txt

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More Unix Commands Interview Questions

What Command will remove a Directory in UNIX?

8 Answers   IBM,


Is there any method to erase all files in the current directory, along with its all sub-directories, by using only one command?

0 Answers  


How can you create a symbolic link to a file or directory?

1 Answers  


What difference between cmp and diff commands?

0 Answers  


what is the advaantage of each user having its own copy of the shell?

2 Answers   Infosys,


Which command is used to delete all files in the current directory and all its sub-directories?

0 Answers  


fork in unix ?

4 Answers   BFL,


what is the difference between pipe(|) and tee command..

3 Answers   Cap Gemini, Rolta,


what are the different operating systems available?

3 Answers  


What is awk used for?

0 Answers  


what are the different commands used to view the contents of a file?

5 Answers  


write grep commands to select the lines that have exactly two characters

8 Answers   PSI Data Systems,


Categories