Search and Repalce a particular word in VI Editor(UNIX)

While using VI editor in UNIX many of us come across a need to Replace a particular word with another word.
Say our file containing a text information as follows
"Ramu and giri are really nice friends. Both of them work in the same office. Ramu working as SWE and giri working as Accountant"
In the above text information if we want to replace all instances of the word Ramu with Krishna the following steps will help
Press Esc
give :
type like this


Some more similar tricks here
More about Vi

1 comments to "Search and Repalce a particular word in VI Editor(UNIX)"

  • for confirming the replace of the word use 'c' suck as


    This will ask for ur confirmation before replacing the pattern xyz with abc.

Post a Comment

Who ever writes Inappropriate/Vulgar comments to context, generally want to be anonymous …So I hope U r not the one like that?
For lazy logs u can at least use Name/URL option which don’t even require any sign-in, good thing is that it can accept your lovely nick name also and URL is not mandatory too.
Thanks for your patience
~Krishna(I love "Transparency")
వీలయితే నాల్గు పోస్టులు ...కుదురితే ఒక కామెంటూ ...


Enter your email address:

Buffs ...


hits counter
View My StatsCheck Google Page Rank

Add to Google Reader or Homepage

Bookmark and Share


Powered by WidgetsForFree