Skip to main content
3 of 4
deleted 4 characters in body
ilkkachu
  • 148k
  • 16
  • 268
  • 441

count number of string occurrences

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 
stdcerr
  • 2.1k
  • 14
  • 49
  • 75