Subject: Re: Read From File

From: [email-masked] (David W. Tamkin)
Date: Thu, 13 Apr 1995 15:37:26 -0500 (CDT)

Jerry Alexandratos asked,

| I've got mail that I expect to receive from a whole bunch of people
| that all needs to end up in the same place.  Now, Since I would prefer
| not to have to make a recipe that is one long line for the *^TO
| condition, I would like to know if there is anyway to put the
| information in a file (like a name per line), and then just have
| something like the following in my .procmailrc:

You wish to identify mail _from_ these people, but you're using a ^TO
condition?

| :0
| *^TO*$FILE  (where $FILE would be the name of the text file)
| folder/.

Jerry, you really have to break that stray asterisk habit!  The one you
have there between the O and the $ would mess things up like the one that
was trashing your mail in yesterday's question.

| Is this at all possible?  Is there a way to do this, which isn't as
| oversimplified as this?

It did come up at least once before, so I'll repeat the suggestion I made
then.  In fact, I think that thread finished in private email, so this might
be the first time it makes it to the list.

Actually, I'm going to change it: the other time I recommended putting a
pipe and a backslash on every line of the name file except the last (or
ending it with a blank line), but just in case someone else maintains that
file and can't be counted on to do it right, let's say that the file
consists, one per line, of search expressions for each person involved.
[Whoever maintains that file will have to remember that it contains search
expressions, not literal text, and will have to escape any magic characters
if they should be taken literally, such as periods or parentheses in the
addresses; there's no easy way around that except perhaps a condition
involving *?fgrep.]

Then assign

 NAMELIST=`sed '$!s/$/|\\/' name_of_file`

And the recipe can look like this:

 :0
 * $ ^TO($NAMELIST)
 directoryname/.

The total length of the condition line after $NAMELIST is expanded has
to fit inside LINEBUF.