Remove duplicated rows of a csv or tsv file
Print duplicates:
$ sort file.csv | uniq -d
Create a new file without duplicates:
$ awk '!seen[$0]++' file.csv > no_dup.csv
Where I understand $0 is the whole line/row of arguments; so the whole line/row would have to be identical for it to be removed. In some of the file I have I want to remove the line if the email address of the entry/line/row is a duplicated. So, I substituted $0 for $5, that is the fifth field, in awk terminology (the fifth column):
$ awk '!seen[$5]++' file.csv > no_dup.csv
And this worked for me, but I can find an explanation that corroborate this syntax.
More commands at: https://yctct.com/data-cleaning-101
personal computing command-line interface (cli) gnu linux trisquel shell literacy wiki data