To count the occurrences of lines in a file the simplest thing to do is:
$ sort file | uniq -c
Question
I have a very large set of strings, one on every line of a file. Many strings occur more than one times in the file at different locations.
I want a frequency count of the strings using unix commands like awk, grep, uniq and so on. I tried few combinations but it didn't work.
what is the exact command to get the frequency count?
Solution
To count the occurrences of lines in a file the simplest thing to do is:
$ sort file | uniq -c