You can use:
sort | uniq -c | awk '$1 == 3'
uniq -c gives you the number of occurrences in the first column. Row awk filters all rows with 3 in the first column.
If you want all elements having 3 or more times write $1 >= 3
You can also select only the names of the elements with (if they are just one column without spaces):
sort | uniq -c | awk '$1 >= 3 {print $2}'
Ans so on ...
source share