posts under linux tag

Perform a replacement on multiple files

find /my_folder -name "*.php" -exec sed -i "s/search/replacement/g" {} \;

And some explanations :

/my_folder
the directory where to search (recursively).

-name "*.php"
the files I want to process.

-exec a_command \;
means I want to execute a_command command on each file found. In this example, the command is sed -i "s/search/replacement/g" {}, the {} parameter will be replaced by the name of each file found.