in reply to History Meme, in Perl!

I think you may enjoy the -a and -n command line switches.