Received: from PROOF.ERGO.CS.CMU.EDU by K.GP.CS.CMU.EDU; 11 May 88 15:40:36 EDT
Received: from PROOF.ERGO.CS.CMU.EDU by PROOF.ERGO.CS.CMU.EDU; 11 May 88 15:39:23 EDT
To: bovik@k
Subject: HG to MH mail conversion
Date: Wed, 11 May 88 15:39:17 EDT
Message-ID: <20624.579382757@PROOF.ERGO.CS.CMU.EDU>
From: Gene.Rollins@PROOF.ERGO.CS.CMU.EDU


 I have developed a convenient way to convert hg format mail files back to
the original unix format mail files, which mh can read.   The shell script,
convert-hg, is given below, along with two files that it references.

 Note: if you used hg to classify mail and you want to retain this
classification, copy the file convert-hg-script and replace the line
containing the list all command to a sequence of list commands, one
for each class, writing to separate mail files.  You'll also have to modify
the shell script convert-hg.  You can then read these separate mail files
into different mh folders.

 This software is provided as a public service.  Although I have
tested it, no guarantee of its usefulness for any purpose is intended.
Any damage or loss that using this software causes is the sole problem
of the user.


APPENDIX A: convert-hg (shell script)
--------------------------------------------------
#! /bin/csh -f
# NAME convert-hg
# SYNOPSIS convert-hg [ message-file ]
# DESCRIPTION Converts hg format mail files to standard unix format mail files.
#             Input is message-file if supplied or else ~/mail.hg. Output is
#             to standard output.  To convert this mail to mh, you can use
#             the mh command:
#                    inc -file name
#             (where name is the file containing the unix format mail)
# FILES
#  This shell script references convert-hg-script and convert-hg.sed, which
#  are expected to be located in the current working directory.

onintr done
sed "s/XX/$$/" convert-hg-script > /tmp/convert-hg-script-$$
hg $* < /tmp/convert-hg-script-$$ > /tmp/convert-hg-log$$
sed -f convert-hg.sed /tmp/convert-hg.out$$
done:
 rm -f /tmp/convert-hg.out$$ /tmp/convert-hg-script-$$ /tmp/convert-hg-log$$
--------------------------------------------------
APPENDIX B: convert-hg.sed (sed input file, referenced by above shell script)
--------------------------------------------------
s/^.*$//
--------------------------------------------------
APPENDIX C: convert-hg-script (hg script file)
--------------------------------------------------
pro set list
no
no
yes
yes
yes
no
yes
yes
no
list all //tmp/convert-hg.outXX
quit
--------------------------------------------------

