procmail
[Top] [All Lists]

Re: Counting hits

2004-06-03 15:11:03
On Thu, Jun 03, 2004 at 04:37:21PM -0400, fleet wrote:


I might actually try it if I could comment the individual lines like:

:0
* -1^0
* 1^1 some condition   #All such things are bad
* -1^1 the exception   #Except those that contain this.

But I don't believe that's allowed.

There is a way to trick procmail into allowing a comment on a line.
It works because "zero or more of something" evaluates to nothing.
I actually use this in a couple of places in my test harness,
which I always run with verbose logging on.


  :0
  * 1^0  condition1 (This is one comment)?
  * 1^0  condition2 (This is another comment)?
  action


Here is a log:
procmail: Score:       0       0 "condition1 (This is one comment)?"
procmail: Score:       0       0 "condition2 (This is another comment)?"


Let's try it on something that's sure to match:

  :0
  * 1^0  ^^From (This is one comment)?
  * 2^0   ^Message-ID:(.*\<)?(This is another comment)?
  { SCORE = $= }


Log (from being run on a random spam message):
procmail: Score:       1       1 "^^From (This is one comment)?"
procmail: Score:       2       3 "^Message-ID:(.*\<)?(This is another comment)?"
procmail: Assigning "SCORE=3"



Btw, I have a var set in my variables INCLUDERC:

 placefinder = "(^Kilroy was here)?"


Then, if I'm testing somethig and want to see where the hell I am
in the run, I stick in the middle of the recipe:

  :0
  * 1^0 scored something
  * $   $placefinder
  * 2^0 more scored somethings
  { we_are_here }

Doesn't have to be limited to a scoring recipe.  Anyway, here:

procmail: Score:       0       0 "scored something"
procmail: Match on "(^Kilroy was here)?"
procmail: Score:       0       0 "more scored somethings"


Especially useful when you can't see what the "somethingses" are in
the log.

-- 
dman

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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