A little script: howmany

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:

#!/bin/sh
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.

These are my WanderingThoughts
(About the blog)

GettingAround
Full index of entries
Recent comments

This is part of CSpace, and is written by ChrisSiebenmann.

* * *

Atom feeds are available; see the bottom of most pages.

This is a DWiki.
(Help)

Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web

Search:
Written on 11 April 2006.
(Previous | Next)

Page tools: View Source, Add Comment.
Search:
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.