Subject: Re: Unpacking majordomo digests

From: [email-masked] (David W. Tamkin)
Date: Mon, 10 Apr 1995 14:20:44 -0500 (CDT)

Eduard Martinescu asked,

| 	I am having some problems trying to split some Majordomo digests.  I
| am subscribed to a list run by majordomo.  I get digests about a couple of
| times a week.  I uses the following recipe to split the digest.

  :0
| * ^Subject: 2020World Digest
| {
|
| 	DIGEST=`formail -xSubject:`
| 	:0 c
| 	|formail +1 -A"X-Digest: $DIGEST" -dnes procmail
|
| 	:0:
| 	2020world
| }
|
| I have had to use the 'c' flag and store the whole digest into my folder
| because sometimes, the digest includes an article in the introductory
| header, before the digested messages.  If I take out the +1 on the formail
| line, I get stuck in an infinite loop trying to process the digest.... Does
| anyone have any suggestions on how I can split the digest so that the
| introdcution is put in a separate message?

Easy; change the entry conditions to this:

    :0
    * ^Subject: 2020World Digest
    * !^X-Digest:

and then drop the +1.  Also, you might want to forgo the -n option on
formail, since it spawns a lot of extra simultaneous processes that just
end up waiting around to do their jobs one at a time anyway.

In 3.10 or later the whole thing can be done a lot more efficiently with
many fewer processes and no worries about loop detection:

  :0
  * ^Subject: \/2020World Digest.*
  {
	:0c:  # if you feel safer storing a copy of the original first
	2020digests

  	:0fw
  	|formail -A"X-Digest: $MATCH" -des

  	:0r:
 	2020articles
  }