I have a list of names, one name per line saved as a .txt file.
I'm trying to use bash to determine how many different names appear once, two times or three times.
For example:
names.txt looks like
Donald
Donald
Lisa
John
Lisa
Donald
In this case the amount of unique lines is 1, there's 1 duplicate and 1 name appears 3 times. I'm trying to get these amounts on a bigger list with using uniq
. I know that I can use uniq -u
and uniq -d
for uniques and duplicates but I'm not quite sure how to do it with names that appear 3 times.