Return list of triplicates Return list of triplicates bash bash

Return list of 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 ...