From: https://snippets.dzone.com/posts/show/116
An equivalent of the other find-replace, except it’s a one-liner that generates no temp files, and is more flexible:
perl -pi -e 's/find/replace/g' *.txt
Or, to change matching files in a hierarchy:
find . -name '*.txt' |xargs perl -pi -e 's/find/replace/g'
That didn’t work when the file names contained white space. This seems to work even with them (with GNU find and xargs):
find . -name '*.txt' -print0 |xargs -0 perl -pi -e 's/find/replace/g'