[PLUG] bash question

Don Buchholz don at truedisk.com
Mon Sep 9 15:52:01 UTC 2002


   $ cat _file_ | sort | uniq -c



Richard Seymour wrote:

> Simple question I've seen answered before (in a variety of ways) but 
> can't think of how now that I need it.
>
> I have a list of strings like this:
>
> a
> a
> a
> b
> b
> c
> d
> d
> d
> d
>
> I'd like to produce a report that counts how many of each unique 
> string there are, something like this:
>
> a 3
> b 2
> c 1
> d 4
>
> I don't care a lot about the format. It could be in any order, the 
> count could come first or second, whatever.
>
> I know there's some easy bash way to do this, which eludes me now.
>






More information about the PLUG mailing list