Home  |  Linux  | Mysql  | PHP  | XML
From:Li, Jialin Date:Wed May 14 15:05:08 2008
Subject:Re: faster ways than perl?
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 <rich.japh@gmail.com> 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: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>

Navigate in group perl.beginners at sever nntp.perl.org
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by PHP Developer
Powered By PHP Consultants