I have a data file which contains 15000 lines, but only 400 unique values. I am looking for a way to identify the number of unique values and then the number of occurrences of those values in the file. I came up with the following but it is very very slow. Any thoughts?
for value in `cat mylist.txt | uniq` do counter=`grep $value mylist.txt |wc -l` echo $value $counter done