[GLLUG] Change text in multiple files
dpk
dpk at egr.msu.edu
Tue Jul 27 13:40:29 EDT 2004
Seth Bembeneck wrote:
> Is there an easy way to change text in lots of files at one time?
>
>
>
> Specifically, I need to change all references to "index.php" in my php
> scripts to "home.php"
>
>
>
> The php files are spread out among several sub-folders.
>
>
>
> Is this possible??
find /path/to/dir -name '*.php' \
-exec perl -pi.bak -e 's/index\.php/home\.php/g;' {} \;
Note: this will create a backup of the file with the extension .bak
incase that isn't really what you wanted to do.
dpk
More information about the linux-user
mailing list