Blog Moved

This blog has been moved to a new URL. No further posts will be made to this blog.

Please click here to be taken to the corresponding post on the new blog. (This usually works. Some pages had their URLs changed. Sorry about those.)

Monday, November 19, 2012

Perl Filters

A nice trick for easily writing Perl filters:

perl -pe 's/a/b/g'

will do the substitution on each line of input and spit it back out. And:

perl -i bak -pe 's/a/b/g' file1 file2....

will do the same, except it will change the given files and back them up to file1.bak, etc, as it does so.


No comments:

Post a Comment

Comments welcome, but they are expected to be civil.
Please don't bother spamming me. I'm only going to delete it.