we have a file as below
AREA,COUNTRY,RANK
A,MX,1
A,MX,2
A,MX,5
A,MX,8
A,IN,7
A,IN,5
A,IN,21
B,CN,6
B,CN,2
B,CN,8
B,CN,0
we need the TOP 2 RANK records for the combination of Area, Country as below. i know
head -2
, which gives top 2 records from file but not sure it lists based on specific fields. plz help me out.
A,MX,8
A,MX,5
A,IN,21
A,IN,7
B,CN,8
B,CN,6