[GLLUG] Change text in multiple files
Seth Bembeneck
sbdataspiller at sbcglobal.net
Tue Jul 27 13:04:33 EDT 2004
Thanks, Just ran it on a back up of my files and it looks like it ran
perfectly.
Seth
-----Original Message-----
From: Ben Pfaff [mailto:blp at benpfaff.org] On Behalf Of Ben Pfaff
Sent: Tuesday, July 27, 2004 12:13 PM
To: Seth Bembeneck
Cc: 'GGLUG'
Subject: Re: [GLLUG] Change text in multiple files
"Seth Bembeneck" <sbdataspiller at sbcglobal.net> writes:
> Specifically, I need to change all references to "index.php" in my php
scripts to "home.php"
Something roughly like this:
find . -name \*.php -print0 | xargs -0 perl -pe
's/index\.php/home.php/g;' -i.bak --
or if you don't have a huge number of files with weird names:
perl -pe 's/index\.php/home.php/g;' -i.bak -- `find . -name \*.php`
Then after you make sure it's okay, delete the .bak files.
--
"Writing is easy.
All you do is sit in front of a typewriter and open a vein."
--Walter Smith
More information about the linux-user
mailing list