Skip to main content
Post Closed as "Duplicate" by Sergiy Kolodyazhnyy, slm

count 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 

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 

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 
deleted 4 characters in body
Source Link
ilkkachu
  • 148k
  • 16
  • 268
  • 441

I have a long log file with many JSON lines and 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 

In Bash, howHow can I extract the number of occurrences each string has using common command-line tools?

i.e. I would like to end up with somethinga list like this:

StringA 3 StringB 3 StringC 1 

I have a long log file with many JSON lines and I've extracted strings I'm interested in and now have a list like:

StringA StringB StringA StringA StringB StringC StringB 

In Bash, how can I extract the number of occurrences each string has?

i.e. I would like to end up with something like:

StringA 3 StringB 3 StringC 1 

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 
deleted 6 characters in body; edited tags; edited title
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 266

count number of string occurencesoccurrences

count number of string occurencesoccurrences

I have a long log file with many JSON lines and I've extracted strings I'm interested in and now have a list like:

StringA StringB StringA StringA StringB StringC StringB 

In Bash, how can I extract the number of occurrences each string has?

i.e. I would like to end up with something like:

StringA 3 StringB 3 StringC 1 

count number of string occurences

I have a long log file with many JSON lines and I've extracted strings I'm interested in and now have a list like:

StringA StringB StringA StringA StringB StringC StringB 

In Bash, how can I extract the number of occurrences each string has?

i.e. I would like to end up with something like:

StringA 3 StringB 3 StringC 1 

count number of string occurrences

I have a long log file with many JSON lines and I've extracted strings I'm interested in and now have a list like:

StringA StringB StringA StringA StringB StringC StringB 

In Bash, how can I extract the number of occurrences each string has?

i.e. I would like to end up with something like:

StringA 3 StringB 3 StringC 1 
Source Link
stdcerr
  • 2.1k
  • 14
  • 49
  • 75
Loading