David - Musings of an SRE

Search and Replace multiple files

Just a little note to self on replacing text within multiple files.

find ./ -type f | xargs sed -i 's/string1/string2/g'

This recursively searches for all the files with ‘string1’ and replace it with ‘string2’ from your current path.