Reputation: 129
I have a csv file with duplicate lines and I need to extract only the non repeating lines.
For example, I have
12
13
14
12
13
15
and the desired output is:
14
15
Upvotes: 1
Views: 2377
Reputation: 85785
To find the unique lines in a file you can use uniq -u
(required sorted file):
$ sort file | uniq -u
14
15
An alternative method using awk
:
$ awk '{a[$0]++}END{for(k in a)if(a[k]==1)print k}' file
14
15
Upvotes: 2