Blog Archive

Wednesday, 5 March 2008

Command-line vi

vi +':g /yyyy/s//xxxx/g' +':wq!' tat

This command will load file "tat" into vi, replace all instances of "yyyy" with "xxxx" then save the file and quit vi... or...

vi +':%s/xxxx/yyyy/g' +':wq!' tat

Apparently "%" in this case is a synonym for "1,$"