Wednesday, May 6, 2009

vi find and replace

To perform a find and replace with all entries of a file, enter the colon to invoke ex from vi. Then, from there, enter

:%s/find_string/replace_string/g

For example:

%s/oldHostname/newHostname/g

There are many other ways to do this, but I prefer this method. This is one of the reasons that vi stands for "Voodoo for Intellectuals."

No comments: