|Syntactic Confectionery Delight|
awk and tr heresy (Re: Splitting Array with Variable Spaces)by japhy (Canon)
|on Nov 03, 2000 at 02:25 UTC||Need Help??|
Why use Perl? Do you have to? I'd do something this trivial in tr and awk if I honestly had a choice: tr -d '%' < INPUT | awk '($11 > $14)'
That, however, removes ALL the % signs, which may be less than optimal. Try this, then: awk '0+substr($11,0,length($11)-1) > 0+substr($14,0,length($14)-1)' INPUT
If you really want to use Perl, here's a command-one-liner: perl -lane 'print if $F > $F' INPUT
or even perl -ape '$_ x= ($F > $F)' INPUT
If you need to use it in a program, you'd probably want to stick with the unpack() and substr() solutions given you.
There's more than one way to do it, and dammit, some of them aren't Perl! ;)