Tidbit - Find and Replace Text in Files with Perl

In our Nagios / Webinject environment, we have alot of text configuration files.  Sometimes a simple product update requires me to update LOTS of these files.  A majority of the time, a find and replace is all I need.  Using perl from the command line, I can quickly update a bunch of files saving countless hours of tedious file updates.

Example - Changing text string of Nagios WebInject test cases...

perl -pi -w -e 's/string1/string2/g;' *.xml

This command will replace "string1" with "string2" in all our XML files in the current directory.  Of course I like to take a backup of the entire directory before I run something like this just in case.