Had a boss show me this one once and it really opened my eyes up. I just never paid attention to those "other" switches you could add to the shebang. What he showed me is a way to combine a two line perl script to a find to change every single file in a directory structure at once (The actual scenario was we had a client lose their hostname through shear incompetence and we had to compensate with what they could get from internic - and we needed to change every file in their web site simultatneously because they also had a practice of hardocding URL's into their site - if it isn't complex, it isn't life...).

OK, here's the code, followed by the explanation...

#!/usr/bin/perl -pi $_ =~ s/sometext/someothertext/mg;

Yeah, that's the whole script. The secret is in the -pi. Check out the perldoc perl pages for more information - this form replaces the page entriley. You can also set it so perl writes a backup file as it goes too. To use the script, just do a find exec, like so:

find ./ -name "*" -type f -exec ./ {} \;

Believe me, this has been a lifesaver. Like moving netscape server instances between servers so you don't have to retweak....

Zed? Zed's dead, baby, Zed's dead.