procmail
[Top] [All Lists]

Re: formail question (-s and piping to tail)

2007-01-24 09:52:33
On Wed, 24 Jan 2007 09:34:49 -0600 "David W. Tamkin" 
<dattier(_at_)panix(_dot_)com>
wrote:

Dallman Ross wrote:

On Tue, Jan 23, 2007 at 08:01:03PM -0600, Gerald V. Livingston II wrote:

Can someone point out what's wrong with this?

formail <spambox -s formail -X X-Spam-Report: | tail -n +19 >> spamreport2

Well, quite a bit, actually. :-)

Ideas??

Why not test it at a shell prompt until it works?

I had been -- for way too long. That's the only time I start asking
questions on lists.

  cat spambox | formail -zfx X-Spam-Report: -s | tail -n 19 >> spamreport2

David is correct, the above fails in exactly the same way mine did. And now
I know why. Too many unneeded pipes.

The way I was reading the man page "-s" splits and feeds each new message
into a NEW process so I was trying to use -s to split then feed back into
formail to extract the header and pipe to tail. One doesn't use a pipe
after -s, it is not necessary, -s, itself, is the pipe.

Your line *DOES* work if I remove the pipe between -s and tail. But I
always try to avoid earning a Useless Use of Cat Award even if no one will
ever see it.

It turns out that the header extraction and splitting can be done with one
iteration of formail and from the man pages i thought it would require two.
I still don't understand *WHY* it doesn't require two iterations. -s splits
the complete, individual, messages out of the mbox. It seems formail would
have to be called again to do something different with each individual
message.

No, I don't think that that's right either.

  formail -X X-Spam-Report: -s tail -n +19 < spambox >> spamreport2

if I understood Gerald correctly, and I'm wondering if the -e option to 
formail is needed too (if not, it slows things down).

-e was not needed. It's working on less than 200 messages so it might be
required with a larger set. I just need a way to sort out rules that are
consistently hitting on spams but not scoring high enough to make them hit
kill scores. Then I'll feed a (much larger) group of non-spam in and split
out things that are hitting on the non-spam and remove those from the
original list then start raising the scores on what's left.

Just need to feed the output to sort now so it will group identical rule
hits together for separation and counting.

Dallman, the +19 tells tail to output from line #19 to the end of input.
Using just 19, without the + tells tail to output only the last 19 lines. I
have added an 18 line explanation of what the X-Spam-Report header is for
at the top of the header to stop the questions from customers who actually
look through the headers. It adds about 1k to the size of every incoming
message but space is not a problem and it doesn't adversely affect
performance.

Crap -- I just realized as I read through these that it's only adding the
report to messages that score above a certain threshhold. I need to lower
that to get the report on non-spam as well. <sigh> time to start the
collection process again.

Thank you all,

Gerald

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>