I have a file with the following fields
NM001 rp1 210 NM003 rp1 220 NM005 rag 200 NM004 rag 100
I would like to have an output that for every change in column2, find maximum in column4 but also report corresponding column1. So far I found a solution that report column2 and 3 but not column1 because the number in column1 is different. I like to use awk please.
The output should be
NM003 rp1 220 NM005 rag 200