I have below data named atp.csv file
Date_Time,M_ID,N_ID,Status,Desc,AMount,Type 2015-01-05 00:00:00 076,1941321748,BD9010423590206,200,Transaction Successfu
You can try this awk version also
awk
awk -F',' '{print $4,",", a[$4]+=$6}' FileName | sort -r | uniq -cw 6 | sort -r
Output :
3 200 , 4500 1 351 , 5000
Another Way:
awk -F',' '{print $4,",", a[$4]+=$6}' FileName | sort -r | uniq -cw 6 |sort -r | sed 's/\([^ ]\+\).\([^ ]\+\).../\2,\1,/'