Next: Kernel
Up: Overview
Previous: Overview
Linux-ish environments have a dominant theme: Many small, general
utilities are better than a few monolithic ones. Most naive users
perceive that there are many commands, all of which seem to do very
little. This is correct! It's a feature, not a bug! What
frequently eludes new users is the power that many small utilities has.
For example, suppose one manages a web site and would like to see the
number of hits from machines not in the wustl.edu domain, sorted by
decreasing frequency. httpd logs contain lines of the form:
machine - - [date] "GET url" ...
The following pipeline does just what we want:
$ cut -f1 -d' ' /local/httpd/logs/access_log \
| grep -v 'wustl\.edu' \
| sort \
| uniq -c \
| sort -rn \
| head -7
851 crawl4.atext.com
507 cybers65d18.mt.wave.shaw.ca
427 scooter.pa-x.dec.com
224 chris.arach-net.com
136 206.187.18.239
124 gw.envision.com
110 www.st-charles-net.com
$
Reece Kimball Hart
1998-03-18