I have a column which contends duplicate rows, then i will like to delete but to keep the first 2 instances .
Remove duplicate lines which has been repeated more than 2 times
Example input
i 10
i 10
a 12
a 12
b 12
b 12
c 14
c 14
x 14
x 14
y 14
y 14
a 14
a 14
n 13
n 13
m 13
m 13
x 13
x 13
output desired.
i 10
i 10
a 12
a 12
c 14
c 14
n 13
n 13
I tried
awk '!a[$2]++' file
Appreciate your help