Linux bulk search and replace
Doing a bulk search and replace across a set of files is actually surprisingly easy. sed is the key. It has a flag - i that will modify the files passed to it in-place.
|
|
Tie this power with either grep -l
. (Thanks to Steve for pointing out a
mistake in the following, now corrected)
|
|
or find
|
|
If there are multiple changes you want to make, just put them all into a file and pass it in via the -f flag.
file: replacements.patterns
|
|
and the command, using find to iterate through all files in the current directory and subdirectories.
|
|
et voila - hope it helps.