[Omaha.pm] Another 30s script

Jay Hannah jay at jays.net
Tue Nov 22 17:23:01 PST 2005


On Nov 18, 2005, at 6:49 PM, Andy Lester wrote:
>    perl -n -a -F'\|'  -e'print if $F[2] =~ /[^a-z0-9]/' j.unl
>
> This has the benefit of being able to operate on multiple files, not
> just the one.  The -n says "loop through the input files."  The -a
> says "automatically split $_, the input line, into @F".  The -F says
> what to do the split() on.  The pipe in the -F parm has to be
> backslashed because the -F parm is always a regex.

Whoah, cool! While I was already hip to -n and -e I'd never used -a -F 
before. Thanks!

Is there anything you can't do in a one-liner? -laugh-

$ perl -2005_tax_return
Unrecognized switch: -2005_tax_return  (-h will show valid options).

Damn.  Laugh,

j




More information about the Omaha-pm mailing list