Skip to main content
1 of 2
ogarogar
  • 191
  • 1
  • 6

Using awk to write only duplicates

Deleting duplicates with awk is pretty common and simple. But I need to print only those lines that are duplicated ,when we compare only one column. I tried this command :

awk 'seen[$2]++'

but as u can see it has flaws. It prints duplicates, but only since their 2 appearance. I've only started getting used to unix and bash, so would be great with besides answer u could explain a solution to me.

ogarogar
  • 191
  • 1
  • 6