Return list of triplicates
To find duplicates you can use
sort | uniq -d
but is there a quick way to find triplicates?
You can use:
sort | uniq -c | awk '$1 == 3'
uniq -c gives you a count of occurences in the first column. The awk line filters all lines with has 3 in the first column.
If you want all items occuring 3 or more times write $1 >= 3
You can also pick out just the items names with (if they are just one column with no spaces) with:
sort | uniq -c | awk '$1 >= 3 {print $2}'
Ans so on ...
精彩评论