I would like to remove duplicate lines in a file (duplicates of column 2) keeping the complete first line for each duplicate.
Example input:
10.4.14.1,201s-1-S
10.4.16.1,201s-1-S
10.4.17.1,40-MDF-S
10.4.18.1,201s-1-S
10.4.19.1,201s-1-S
10.4.20.1,201s-1-S
10.4.21.1,201s-1-S
10.4.22.1,201s-1-S
10.4.23.1,201s-1-S
10.4.24.1,MDF-S
Desired result:
10.4.14.1,201s-1-S
10.4.17.1,40-MDF-S
10.4.24.1,MDF-S
So far I have tried
awk '!k[$5]++' file
and
awk '!_[$5]++' file
but this does not yield my desired output.