· 1 min read · Dev-Sys

Global search and replace using Vi

to replace all instances of - say - 127.0.0.1 with 10.0.0.1 in a file then using vi you can do:

:%s/127.0.0.1/10.0.0.1/g

if you mess it up then press u for undo. Of course if it's an important file then back it up first.