On Fri, 2010-04-23 at 14:50 +0200, Israel Garcia wrote:
> On Fri, Apr 23, 2010 at 2:47 PM, Tonu Samuel <t...@jes.ee> wrote:
> > On Fri, 2010-04-23 at 14:44 +0200, Israel Garcia wrote:
> >> I know there're a lot of postfix stats programs, but how can I get
> >> ONLY, the total number of email sent by postfix except for a couple of
> >> local domains? Can you help me?
> >
> > awk does it.
> Hi Tonu,
> :-) I suppose awk does.. maybe grep too but, I don't know how..  can
> you help me?

Ok. Let's do it with grep:

grep /var/log/mail.log | grep Sent | grep -rvi "dom1.com\|dom2.com" | wc

Have not tested it but this is the idea.

grep flags:
-r regular expression (to make | work)
-i case insensitive
-v match things NOT in expression

wc counts chars, words and lines. Last one is what you want. You can
add 

cut -f 3 -d ' ' 

to cut out third field in space separated line.

http://www.vectorsite.net/tsawk.html can be useful too.


  Tõnu

Reply via email to