This is a super helpful perl script I came across when I needed to find and replace across multiple text files.
find . -name “*.php” |xargs perl -pi -w -e ’s/search_this_text/replace_with_this/g;’
The small script above (to be run on the command line/shell) recursively searches for all the php files and replaces “search_this_text” with “replace_with_this”. It works great and is quite fast.
I’m upgrading a huge site to PHP5 so this little script helps a lot when it comes to fixing all those mundane mistakes I made writing the site in PHP4. Now that everything ‘works’ in PHP5, it’s time to go through and start making it work better. Running Linux (Ubuntu: Dapper Drake) as my main portable desktop OS definately has it’s perks. It seems that all the scripting tools I could ever want or need are in there somewhere, I just have to need them before I find them some times.
Burn My Time © 2007.
Simple Grey theme developed by Rodrigo P. Ghedin.
Brought by Wordpress Themes