Locate and Replace Numerous Instances of the Same String Using vi

To locate and replaceĀ a string of text in a file using use the below text.

shell# vi filename

Once in vi use the following:

:%s/string/new-string/ <enter>

That will replace any instance of string with new-string.

Share