procmail
[Top] [All Lists]

Re: Avoiding unnecessary call

2001-02-26 01:32:48
++ 07/01/01 13:55 -0600 - Philip Guenther:
      :0
      * ^Envelope-To: stemformulieren(_at_)sisterray\(_dot_)xs4all\(_dot_)nl
      * ^Subject: .*\/nl\.[-a-z_0-9.+]+
      {
[comments snipped]
          regex = "^$\MATCH[  ].*[    ]Running\."
[comments snipped]
          :0
          * ? egrep -iq "$regex" ${VOTEDIR}/stemmingen.txt
          {
              :0 c:
              $VOTEDIR/$MATCH/backup/votes

              :0:
              $VOTEDIR/$MATCH/votes
          }
      }

Just to let you know, there was one caveat:

We're looking up for a pattern that matches "nl\.[-a-z_0-9.+]+". Then
this name is looked up as a part of bigger pattern in a file. It it
exists, the message will be saved to a directory with that name.

This works as long as voters only have lowercase groupnames in the
Subject field. Uppercase will result in locking errors as the first
recipe is case-independent and the we are grepping case-independent as
well. A (partly) uppercase name will get thru both, but saving to 

        $VOTEDIR/nl.groupname/votes 

is a different thing from

        $VOTEDIR/Nl.Groupname/votes

That's a thing i had overlooked. I have now solved it with:

        :0
        * ^Subject: .*\/nl\.[-a-z_0-9.+]+
        * ? grep -i "${MATCH}.*Running" ${VOTEDIR}/stemmingen.txt >/dev/null
        {
                NG=`echo $MATCH  | tr [:upper:] [:lower:]`

                :0 c:
                $VOTEDIR/$NG/backup/votes

                :0:
                $VOTEDIR/$NG/votes
        }

But, except for this, thanks a lot for your help! This works...

        -R.



-- 
# rejo(_at_)sisterray(_dot_)xs4all(_dot_)nl (pgp: see headers) - 
http://www.sisterray.nl
_______________________________________________
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>