a blogging break

I probably won’t be blogging from now until the end of next week. I’ll post an entry or two if I manage to get internet access, but it’s very likely there won’t be any where I’ll be.







handy perl script

If you want to search and replace text among lots of files, Perl can make your life a lot simpler. Here is a script to replace the string ‘old_text’ with ‘new_text’ in any file ending with .txt. The script would have to be run from the same directory as the files which have the text you want replaced.

#!/usr/bin/perl

@files = <*.txt>;

foreach $file ( @files )
{
    system( "perl -p -i -e 's/old_text/new_text/g' $file" );
}

In order to use this code, copy it to a file and save it, then run the following command on the file.

chmod 755 <filename>






Number of readers
- home
comics
news links
other links

about me
blog archives
docs
entertainment
experiences
funny lists
humor
intellectual
interests
metafilter
music
opinions
photos
web designs
tools
software
webmaster help

Sign up
Enter your email address to be notified of new posts



Search blog archives

Calendar
August 2004
S M T W T F S
« Jul   Sep »
1234567
891011121314
15161718192021
22232425262728
293031  







Random quote
(View all quotes)
"Diplomacy is the art of saying 'nice doggie' until you can find a rock."










(?) Choose theme:  X X X X X X