This question already has an answer here:
I've extracted strings I'm interested in from another file and now have a list like this:
StringA StringB StringA StringA StringB StringC StringB
How can I extract the number of occurrences each string has using common command-line tools?
I would like to end up with a list like this:
StringA 3 StringB 3 StringC 1