SED Search / Replace Multiple Files

I’m a big fan of the “replace” utility included in the mysql client package. With this utility you can search/replace a string of text across multiple files like this:

replace 'from-string' 'to-string' -- start-folder/*.pl

Quick and easy!

But on occasion I’m on a system that doesn’t have the mysql client package so here’s a similar function using find and sed:

find start-folder/ -name '*.pl' -exec sed -iorig 's/from-string/to-string/' {} \;
blog comments powered by Disqus