I have a file that looks like this:

cat f1.csv:

```
col1,col2,col3
AK136742,BC051226,996
AK161599,Gm15417,4490
AK161599,Gm15417,6915
AK161599,Zbtb7b,1339
AK161599,Zbtb7b,1475
AK161599,Zbtb7b,1514

```

What I want to do is to keep one of the otherwise-duplicated rows if they have a greater number on col3. So if the col1 and col2 are the same then keep the row if has the greater number on the col3.

So the desired output should be:

```
col1,col2,col3
AK136742,BC051226,996
AK161599,Gm15417,6915
AK161599,Zbtb7b,1514

```

I used the command below but it does not solve the problem:

```
cat f1.csv | sort -rnk3 | awk '!x[$3]++'

```

Any help is appreciated - thanks!