grunt> dump jn;
(k1,k4,10)
(k1,k5,15)
(k2,k4,9)
(k3,k4,16)
grunt> jn = group jn by $1;
grunt> dump jn;
(k4,{(k1,k4,10),(k2,k4,9),(k3,k4,16)})
(k5,{(k1,k5,15)})
Now from here I need the following output:
(k4,{(k3,k4,16),(k1,k4,10)})
(k5,{(k1,k5,15)})
Basically, I want to sort by numbers: 10,9,16 and select the top 2 for each row.
How to do it?