Posted By: spling
Sorting variables in descending numeric order. - 12/11/04 03:17 AM
I need to find the top ten variables in a hash table. Could I use a filter and a loadbuf to do this? How would I do it. I haven't use either command before, and they're both complicated O_o
Thanks in advance.
Posted By: Sigh
Re: Sorting variables in descending numeric order. - 12/11/04 07:24 AM
It's not too complicated, you can use /hsave -n to save all data values in the hash table to a file. After saving use /filter to sort it, /filter -ctffeu 1 10 file file where it sorts the lines numerically (looking at the whole line since chr 10 was specified as the token separator and it cannot exist in a line) in descending order
Now the highest data value is the first line of the file, you can use $hfind to refer back to the data item/s