What a find…

First off, this is a warning. If you read this blog for the sports, music, or family talk skip this entry because I’m gonna get “nerdy”.

I was very happy to find a new trick with the “wc” cmd. I’ve been researching a ClassCastException problem in our prod env and needed to get some line counts in log files by day and minute. Skipping to the point. When I wanted line counts I always did the old:

sun1@ae5 [/ae/ias-6.5/ias/logs/19] > cat kjs_1_CCS0 | wc -l
sun1@ae5 [/ae/ias-6.5/ias/logs/19] > cat kjs_2_CCS0 | wc -l
sun1@ae5 [/ae/ias-6.5/ias/logs/19] > cat kjs_3_CCS0 | wc -l
sun1@ae5 [/ae/ias-6.5/ias/logs/19] > cat kjs_4_CCS0 | wc -l

But look what you can do.

sun1@ae5 [/ae/ias-6.5/ias/logs/19] > wc -l kjs_*.o*
3828 kjs_1.out
3494 kjs_2.out
33 kjs_3.out
35 kjs_4.out
7390 total

“wc” takes a filename(s) arg and counts each arg. It’s quicker and looks cleaner! Enough over-analyzing “wc”, but I was just so proud of my new find. Go forth and count…. stuff.

Leave a Reply