Home > Tips & Tricks > Search and replace multiple files

Search and replace multiple files

Print Friendly, PDF & Email

In the example below we are replacing every occurrence of mama with papa in all .html files in current path using Perl.

perl -pi -e "s/mama/papa/g;" *.html

We do the same thing here but make a copy of original file for backup.

perl -pi -e.bak "s/mama/papa/g;" *.html
Categories: Tips & Tricks