O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  

Building Complex Command Lines - Improved
Eliminate shell iteration by using more command options.

Contributed by:
Walt Sullivan
[04/17/03 | Discuss (2) | Link to this hack]

In Linux Server Hacks, First edition, Hack #6 can be improved by using uniq to count the number of "missing" files, rather than the for loop, and letting sort find the number and reverse the order:

grep "File does not exist" error_log | \
awk '{print $13}' | \
sort | \
uniq -c | \
sort -rn | \
head -20

See also:

  • Linux Server Hacks #6
  • man uniq
  • man sort

O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.