Procmailers, I took the route suggested by various Dave's, and wrote
a shell script that fires up procmail to process individual mail
messages, breaking up digests as it goes. Here's the script, perhaps
it will be useful. If you see opportunites for improvement, let
me know.
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: unpack_mail
# Wrapped by gary(_at_)presto on Sun Feb 16 12:41:47 1997
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'unpack_mail' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'unpack_mail'\"
else
echo shar: Extracting \"'unpack_mail'\" \(1706 characters\)
sed "s/^X//" >'unpack_mail' <<'END_OF_FILE'
X#!/bin/csh -f
X#
X# unpack_mail - Unpack mail, which is made up of individual messages,
X# or a series of mail digests.
X#
X# usage: unpack_mail [file ....]
X#
X# inputs: read from the filenames given on the command line.
X#
X# output: a reformatted undigested mail file.
X#
set procrc = /tmp/procrc.$$
onintr cleanup
cat << 'EOF' > $procrc
X#
X# set DEFAULT so that result is delivered to stdout
X#
LOGFILE=unpack-log
DEFAULT=|
MAIL=
SENDMAIL=
VERBOSE=yes
X
X#
X# Skip all messages from foo(_at_)bar
X#
X:0
X* ^FROM(_dot_)*foo(_at_)bar
X/dev/null
X
X#
X# Filter out extraneous fields
X#
X:0 f
X| formail -b -I 'Received:' -I 'Status:'
X
X#
X# Filter out noise added into digests
X#
X:0 f
X* ^Subject:.*digest
X| sed -e '/^------------------------------/d' \
X -e '/^End of .* Digest/d' \
X -e '/^\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/d'
X
X#
X# if it looks like a digest, then split it up
X#
X:0 f
X* ^Content-Type:.*multipart/digest
X| formail -m 3 +1 -ds
X
X:0 Ef
X* ^Subject:[ ]*[a-zA-Z0-9]*[ ]*digest[ ]*[0-9]*
X| formail -m 3 +1 -ds
X'EOF'
X
X#
X# set the FILEN0 env. var. if not already set.
X#
if (! $?FILENO ) then
X set m = `find . -name 'msg.*' -depth -prune -print | \\
X tail -1 | sed -e 's=\.\/==' -e 's/msg.//'`
X if ("$m" =~ [0-9][0-9]*) then
X # If msg.* files already exist, then use the next available number.
X set m = `echo $m | awk '{printf "%05d", $0 + 1}'`
X setenv FILENO "$m"
X else
X setenv FILENO "00001"
X endif
endif
X#
X# First run procmail using the $procrc control file, and then
X# write each resulting message into its own file.
X#
cat $* | formail -s procmail -m $procrc
X
X# Add this code fragment to create individual message files.
X# | formail -s csh -c 'cat - > msg.$FILENO'
cleanup:
rm -f $procrc
END_OF_FILE
if test 1706 -ne `wc -c <'unpack_mail'`; then
echo shar: \"'unpack_mail'\" unpacked with wrong size!
fi
chmod +x 'unpack_mail'
# end of 'unpack_mail'
fi
echo shar: End of shell archive.
exit 0