Thursday, February 11, 2016

Recursive Replace Text in Files

If you ever have a need to replace text in files (including subfolders) execute the following linux command.

In the below example we wanted to replace a copyright on a group of html and php pages.
2010 - 2015 became 2010 - 2016


user@machine> find . -type f -name "*" -exec sed -i'' -e 's/2010 - 2015/2010 - 2016/g' {} +