the first sort will be slow considering the amount of data and can be
replaced by using hash

the 21st conlumn should be $F[20]

perl -F"\|" -ane '++$hash{$F[20]}; END { @sorted = sort {$a <=> $b} keys
%hash; print  $hash{$_}, $_, "\n" for @sorted}'  data - Show quoted text -


On Wed, May 14, 2008 at 3:41 PM, Richard Lee <[EMAIL PROTECTED]> wrote:

> I am running this command on over 2 gigs worth of lines....
>
> which one should be faster?
>
> cut -d'|' -f21 * | sort | uniq -c | sort
>
>
> perl -F"\|"  -lane 'print $F[21]' * | sort | uniq -c | sort
>
>
> or is there faster ways to do this on perl?
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
>
>
>

Reply via email to