On 15 Jan, Professional Software Engineering wrote:
| At 11:18 2002-01-15 -0600, Runestone Internet wrote:
| >I need to compile a list of users receiving messages matching a certain
| >condition. Instead of collecting the messages themselves and manually
| >noting the recipients address, I would like to use procmail for the task.
| FTR, the recipient may not be identified in the To:, or for that matter,
| the Cc:.
| >How can I append this value to a file?
| * somecondition_of_course
| * ^To:[ ]*\/.*
|| echo $MATCH >> /path/to/myshiitelist.txt
One very minor nit. The only problem with this is the combination of
procmail's regular expressions being stingy to the left and greedy to
the right of the MATCH token (\/) renders the [ ]* meaningless.
It's a cosmetic issue only, but any leading whitespace after To: will be
captured to $MATCH. If that's not desired, then
* ^To:[ ]*\/[^ ].*
is one possible fix. I use this frequently enough that I define
wsstar='[ ]*' and
wsneg='[^ ]' early in my rcfiles so I can do:
* $ ^To:$wsstar\/$wsneg.*
which is more pleasing to my eye. YMMV. (As always, each of the
character classes above contain <space> and <tab>.)
Reply to list please, or append "6" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.
procmail mailing list