procmail
[Top] [All Lists]

Re: Variable substitution in condition

2003-03-07 13:56:35

-----Original Message-----
From: Professional Software Engineering 
<PSE-L(_at_)mail(_dot_)professional(_dot_)org>
Sent: Thu, Feb 27, 2003 at 11:50:37AM -0800
To procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
Subject: Re: Variable substitution in condition


At 22:37 2003-02-27 +0530, Vikram Goyal wrote:

A VAR is set by reading a list from a file. EX. VAR=foo|bar|abra|cad|
I want to expand it in a recipe. Like:

:0
* ^To.*(${VAR}).*

'man procmailrc' is your friend.  So is 'man procmailex'.

:0
* $ ^To:.*(${VAR})

Note three changes to your recipe:

Addition of '$' modifier flag to the condition line (see 'man procmailrc')

Addition of ':' header-field separator after 'To' - this makes it operate 
ONLY on the To: field, not some bogus crap like "Togetherness: fubar" or 
whatever (generally not a big concern, but unless you're trying to expand a 
match against other headers, it's best to truncate the header 
name).  Failure to truncate certain header names sometimes leads to those 
"why is my recipe matching this message - the To: field doesn't match 
anything here" type queries.

Removal of '.*' from the tail end of the expression.  It is wholly 
unnecessary - you'd include it only for MATCH expressions where you're 
trying to capture more of the text than what explicitly matches the more 
detailed portion of your regexp.

It's quite a late reply but I must thank you for the solution you
provided. It helped me write an ugly looking but working:) hack to sort my
list mails without editing .procmailrc to incorporate changes.

Thanks Again.
-- 
vikram...    <viki(_at_)bol(_dot_)net(_dot_)in>
         ||||||||
         ||||||||
^^'''''^^||root||^^^'''''''^^
        // \\   ))
       //(( \\// \\
      // /\\ ||   \\
     || / )) ((    \\
-- 
Thus My Computer Chittered :
~~~~~~~~~~~~~~~~~~~~~~~~~~
It's OBVIOUS ... The FURS never reached ISTANBUL ... You were an EXTRA
in the REMAKE of "TOPKAPI" ... Go home to your WIFE ... She's making
FRENCH TOAST!
-- 
 o
~|~
 =
Registered Linux User #285795


_______________________________________________
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>
  • Re: Variable substitution in condition, Vikram Goyal <=