Replace text inside a file

February 27, 2004

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.

Make The Call

Get Started

Use this if you’re making an IT decision and want to avoid a costly mistake. Answer four quick questions and we’ll route you to the right next step—strategy, sourcing, contract review, or optimization.

If it’s a fit, you’ll be able to book time immediately.

Start with 4 Quick Questions

Thanks for submitting the form.
By continuing, you agree to be contacted about your request. No spam.