uniq |
-c |
also print number of times each line is duplicated | |
-d |
only print (one copy of) duplicated lines | |
-u |
only print lines that occur uniquely (once only) |
Surprisingly useful tool for summarising data, typically after extraction by cut. Always preceded by sort (why?).
# extract first field, sort, and tally cut -f1 data | sort | uniq -c |