How to replace words in all files?

Svein Halvor Halvorsen svein-freebsd-questions at theloosingend.net
Fri May 13 03:43:19 PDT 2005


* Sergey S. Ropchan [2005-05-13 12:40 +0300]
>  find / -name '*' -print | xargs grep "lnc0" 
>  - gives you all files in your system with lnc0 ...
>  
>  perl -pi.bak -pe 's/lnc0/rl0/' file1 file2 ... fileN
>  - will replace lnc0 - rl0 in all specified files, with backuping of old
>  files in *.bak

Or one could use with the -i option, since sed is in the base system 
(although everyone probably has perl anyway)



More information about the freebsd-questions mailing list