On Fri, 2004-04-02 at 14:33 -0500, John Madden wrote:

> > #!/bin/sh
> > VIRCOUNT=`grep -c FOUND /wherever/is/your/clamd.log`
> 
> I blend in a little perl to print per-virus totals sorted by name:
> 
> grep VIRUS /var/log/messages | perl -e 'while(<>){ $_ =~ /VIRUS:(.*)\)/;
> $v = $1; $hash{$v}++;} foreach $x (sort(keys(%hash))){ print "$x:
> $hash{$x} \n";}'
> 
> (Note that this is taken from syslog while using amavisd, not clamd's log.)

Here is one for the clamd.log in just shell, Perl would probably handle
this a bit better, and not have to run through the file for every virus
name, but this works for me:

for VIRUS in $(grep FOUND clamd.log | cut -d ':' -f 4 | cut -d ' ' -f 2 | sort | 
uniq); do
        echo -n "$VIRUS: "
        grep -c "$VIRUS" clamd.log
done

-- 
Chris



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users

Reply via email to