Re: faster ways than perl?

[email protected] ("Li, Jialin")
Newsgroups perl.beginners
Message-ID <[email protected]>
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/
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.