Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vi Editor 1

Status
Not open for further replies.

Yusuboy

IS-IT--Management
Sep 19, 2003
6
0
0
GM
Hi Guys,

Can you help me with the vi cammand that can find and replace one word with another in a file.

Thanks,
Yus.
 
This command will change all occurrences of 'water' into 'wine':

[tt]:%s/water/wine/g[/tt]

Annihilannic.
 
:g/abc/s//xyz/g

will replace every abc with xyz
 
...and if you want to make changes which include the / character (pathnames for example) you can use another delimiter as in :g!/path/to/change!s!!/new/path!g
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top