|
I think it can work by this way also:
sort file1 |uniq -d > file2
this will extract the duplicated lines and redirects them to file2
you can also specify the number of duplication of every line at the begining of the line:
sort file1 |uniq -c > file2
|