February 27, 2004
Replace text inside a file
Learn how to quickly replace text in multiple files using Perl. This example shows how to replace "shtml" with "php" across all .php files.
To replace all occurances of “shtml” with “php” inside of all of the *.php files in a directory.
$ perl -pi.bak -e 's/shtml/php/' *.php
See: hacks.oreilly.com: Global Search and Replace with Perl for more examples.
