[comp.mail.mh] shell script to burst and mark msgs

jamesp@metolius.wr (James T Perkins) (05/11/91)

I whipped this up for a friend, who suggested I share it with the MH
community.  Always a sucker for flattery, I thought I'd take him up on
it.  :-) His original question was (I paraphrase) 'is there some way to
add burst messages into an mh sequence automatically?'.  Here's what
came of that question.  Before use, edit the line that starts "PATH=" to
point at your MH binary directory.

 ___    ___   ___
|   \  / _ \ / __|  James Perkins, jamesp@metolius.wr.tek.com, (503)629-1149
| |> || |_| |\__ \  Logic Analyzers, DAS 9200 Engineering, Tektronix, Inc.
|___/ |_| |_||___/  MS 92-725, PO Box 4600, Beaverton, OR 97076

This package is sold by weight, not by volume.  Some settling of contents may
have occurred during shipping and handling.

---- cut here ---- script follows ----
: shell script
#
# NAME
#    burstm - burst an MH message and add new messages to sequence "b"
#
# DESCRIPTION
#    Given the nromal arguments to the MH "burst" command, burst the
#    given message, splitting it into new messages.  Adds these new
#    messages into the MH sequence named "b".
#
# EXAMPLE
#    $ burstm 20
#    $ scan b
#    27  05/09 Dave Boddie         Bursted message 1 subject line
#    28  05/10 Fred Ferkle         Bursted message 2 subject line
#    29  07/02 richard@agora.rain  Bursted message 3 subject line
#
# SEE ALSO
#    burst(1), mark(1)
#
# AUTHOR
#    jamesp@metolius.wr.tek.com (James Perkins)
#
# BUGS
#    Doesn't check arguments, so be careful to only specify a single
#    source message to burst.
#
#    No mechanism to change the sequence name.  This could be added by
#    parsing out a "-seq <sequence>" argument from the command-line
#    arguments.

# restrict executable search PATH to MH executable directory
PATH=/usr/ens/bin/mh6:/bin

# sequence to add the bursted files to
SEQ=b

burst -noinplace -verbose "$@" |
    (
	new_msgs=
	while read line
	do
	    set -- $line
	    case $8 in
		[1-9]*) new_msgs="$8 $new_msgs";;
	    esac
	done
	if [ -n "$new_msgs" ]
	then
	    mark -add -seq $SEQ $new_msgs
	fi
    )

jromine@yoyodyne.ics.uci.edu (John Romine) (05/12/91)

James T Perkins <jamesp@metolius.wr.tek.com> writes:
>...is there some way to add burst messages into an mh sequence
>automatically?

If a (digest) message belongs to a sequence, when you burst it,
all the component messages will belong to the same sequence.
--
John Romine