symbol count in a text file [iptables log]
David A. Bandel
david
Mon May 17 11:37:58 PDT 2004
On Sat, 21 Sep 2002 10:09:40 +0800
begin "m.w.chang" <mwchang at netvigator.com> spewed forth:
> further to my questino on an analysis tool for iptables log.
>
> is there a unix textutils or alike that would count the number of unique
> symbols in a text file and produce a frequency distribition of them? It
> should be a common feature in most compilers. I could write one, but
> just wonder whether the wheel has been available already.
>
> with that tool, I could just count the symbol DPT=9999.
>
> Reminded me of the book I dare to read: The C Compiler. Is this a kind
> of lexical analysis?
grep DPT=9999 /var/log/messages | wc
But you'll probably only want one day at a time, in which case, you could
pipe the first grep through another grep for the date:
grep DPT=9999 /var/log/messages | grep "Sep 15" | wc
(note, on single digit dates, you need two spaces between the month/day
"Sep 9")
Ciao,
David A. Bandel
--
Focus on the dream, not the competition.
-- Nemesis Racing Team motto
More information about the Linux-users
mailing list