Search and replace text in many files

Submit to reddit

This is a handy one liner that searches and replaces text in multiple files. (You can use find for example to run it in multiple folders)

perl -pi -e 's/old_text/new_text/g' *.conf

This line replaces old_text with new_text in all the .conf files in the current folder. Of course you can use regular expressions.