Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Need to sort large table of data...

by quester (Vicar)
on Feb 19, 2008 at 05:39 UTC ( [id://668734]=note: print w/replies, xml ) Need Help??


in reply to Need to sort large table of data...

Incidentally, if your array is really "gigantic" - so much so that you need to process it externally to Perl - you may want to write it to a file and sort it with the unix "sort" utility. The following two lines will do everything you want except for the hyphen after the count:
sort -k1n -k2n -k3n -k4n -k5n < inputfilename | uniq -c > outputfilename
and the output will look like this:
2 1 1 1 1 1 1 1 2 1 1 8 1 1 6 5 12 12

Replies are listed 'Best First'.
Re^2: Need to sort large table of data...
by tilly (Archbishop) on Feb 19, 2008 at 07:46 UTC
    Be careful to double-check your locale.

    On Linux with GNU sort I've been bitten in the past by the fact that the default locale does not consider some characters (in that case tabs) to be part of the collating operation.

    For that reason I find it a good precaution to set $LC_ALL to C before using GNU sort.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://668734]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-16 15:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found