Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

petdance (2468)

AOL IM: petdance (Add Buddy, Send Message)
Yahoo! ID: petdance (Add User, Send Message)

I'm Andy Lester, and I like to test stuff. I also write for the Perl Journal, and do tech edits on books. Sometimes I write code, too.

Journal of petdance (2468)

Friday October 29, 2004
10:49 AM

Command line table dumping

[ #21593 ]
Data::Hash::Totals makes it easy for you to do pretty command-line dumping of data, as below:

grep "does not exist" ~/error_log | perl -MData::Hash::Totals -a -F -n -e'++$X{$F[-1]}; END {print as_table(\%X)}'
106 /site/tw/help/images/backgrounds/container.gif
  68 /site/tw/graphics//links/close_window.gif
  53 /site/tw/bk/map2.html
  47 /site/tw/grpahics/links/close_window.gif
  21 /site/tw/bk/map3.html
  15 /site/tw/lgcover.

Note that it requires the latest D:H:T, version 0.02 to work. Good thing I'm uploading that right now.

Addendum: You can leave grep out of it, of course:

perl -MData::Hash::Totals -a -F -n -e'++$X{$F[-1]} if /does not exist/; END {print as_table(\%X)}' ~/error_log

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.