Search and Replace in Vim

by: WanderingTechy Tuesday, September 1st, 2009

I hadn’t used this is a while and needed to change the IP address in a named.conf file.  This is not a full tutorial, it’s just a quick and simple howto for search and replace in Vi(m)

Here is the format :%s/search/replace/gc

For example I want to change aaa.bbb.ccc.ddd to www.xxx.yyy.zzz

:%s/aaa.bbb.ccc.ddd/www.xxx.yyy.zzz/gc

The g means global,  ie do it for multiple occurrences on a single line.
The c means give a confirmation prompt ( you can leave this off if you are confident or crazy)

Related Posts

  • No Related Post

« | Home | »

Related Posts

Related Posts

 

Leave a Comment

Spam Protection by WP-SpamFree