Archive

Posts Tagged ‘oneliner’

Search and replace multiple files

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