A little script: howmany

April 11, 2006

There's a lot of Unix idioms that I use often enough to have turned into little shell scripts. Here's the first of them; I call it howmany:

trap '' 13
sort "$@" | uniq -c | sort -nr

(The trap is necessary because of a Linux bash issue.)

Howmany does what its name says: it counts up how many times each line of its standard input appears, then shows them from most to least frequent with the count. It usually gets used at the end of pipelines that crunch logs and the like.

Written on 11 April 2006.
« xiostat: better Linux disk IO statistics
Something to remember about networking restarts »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Tue Apr 11 01:29:49 2006
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.