Replace strings in files

Replace strings in files

Post by Willem Kosse » Thu, 04 Sep 2003 17:12:00



how do i replace a string with some other string in a number of files with
one command?

Thanks

Willem Kossen

 
 
 

Replace strings in files

Post by Michael Heimin » Thu, 04 Sep 2003 17:45:39



> how do i replace a string with some other string in a number of files with
> one command?

http://groups.google.com/

This question is asked at least twice a week...

--
Michael Heiming

Remove +SIGNS and www. if you expect an answer, sorry for
inconvenience, but I get tons of SPAM

 
 
 

Replace strings in files

Post by Juergen Hec » Thu, 04 Sep 2003 19:01:02



> how do i replace a string with some other string in a number of files with
> one command?

> Thanks

> Willem Kossen

Basic idea:

for f in *.txt ; do vi -c '%s/string/replacement/g | wq' $f  >/dev/null
; done