#! /usr/bin/sed -f # # split_digest # # Splits one digest mail into separate mails by duplicating the # From_ header for each message in the digest. Digest sender's # Reply-To: is also duplicated for each message. # # Script assumes that messages are separated with a line consisting # of hyphens + blank line, following one of the headers From:, Date:, # Subject: or To:. From_ must be found from the first line, and # Reply-To: is seeked from lines 2-20. # # This should work at least for digests generated by Majordomo and # listserv, and FAQs using "minimal digest format". # # Written by Aaro Koskinen (aaro@iki.fi), January 1997. # # Check for From & Reply-To: headers & memorize them 2,$ba /^From /h bb :a 21,$bb /^Reply-To: /H :b # Check for separator /^-*-$/!b n /^$/!b n /^Date: /bc /^From: /bc /^Subject: /bc /^To: /bc b # Split :c x p x