Counting duplicates in a sorted sequence using command line tools

If you can handle the output being in a slightly different format, you could do:

cmd1 | tr " " "\n" | uniq -c

You'd get back:

  3 100
  2 99
  1 26
  1 25
  2 24

Also add in the -u switch. Thus you would have:

cmd1 | sort -gru

From the sort manpage:

-u, --unique
without -c, output only the first of an equal run