Perl Recursive Find and Replace

perl grep find replace command-line linux

Using Perl with grep to perform recursive find and replace operations across multiple files

Perl -pi -e isn’t inherently recursive but there is a simple way to work around this. Using grep in place of the file name can return the path and filename to the string you are trying to replace.

I have included a good example below.

perl -pi -e 's/searchstring/replacementstring/g' `grep -lri searchstring *`