felix@ai.sri.com (Francois Felix INGRAND) (11/15/90)
I have just installed MH but I have not tried it yet. Before I do anything foolish, I was wondering how difficult it is to convert my 50 unix-mail folders to MH format... and how difficult it would be to convert them back (in case I decide MH is not for me). Is there a list of FAQ about MH somewhere I could consult? Thanks in advance, -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Francois Felix INGRAND SRI International, AIC felix@AI.SRI.COM 333, Ravenswood Avenue (415) 859-5584 MENLO PARK, CA 94025, USA "Read my Lisp... No new syntax" (nil)
swb@chumley.tn.cornell.edu (Scott Brim) (11/15/90)
In article <FELIX.90Nov14102803@cayucos.ai.sri.com> felix@ai.sri.com (Francois Felix INGRAND) writes:
Before I do anything foolish, I was wondering how difficult it is to
convert my 50 unix-mail folders to MH format... and how difficult it
would be to convert them back (in case I decide MH is not for me).
It's easy. Assume your vanilla mail directory is ~/mail, and you're
running csh.
First, from mail to MH:
foreach src (`/bin/ls ~/mail`)
inc +$src -file ~/mail/$src
end
Original mail files will be left there (if you're configured in MH
normally).
To get back, well, here's a csh script you can use to get everything
back except the dates. You could probably even get those back in most
cases, but I never did the work to get them back in *all* cases. The
script could probably use some other polishing too, but you know how it
is.
#!/bin/csh -f
# For each mhfolder, take the corresponding mailfolder and inc it
# into MH, then take the MH folder and cat it into the (massaged) mail
# folder. Be sure the ultimate mail folder doesn't have
# slashes in the name.
echo "learning folders ..."
foreach mh ( `folders -fast` )
set ml = `echo "$mh" | tr / .`
echo $mh '=>' $ml ... snatching old mail ...
echo -n " "
inc -file ~/mail/$ml +$mh
cat < /dev/null > ~/mail/$ml
set attop = 1
echo $mh '=>' $ml ... moving mail ...
echo -n " "
set msgs = `pick +$mh all`
if ($status != 0) then
echo " ...forget it"
/bin/rm -f ~/mail/$ml
continue
endif
foreach msg ($msgs)
echo -n "$msg "
if ($attop != 1) then
echo "" >> ~/mail/$ml
echo "" >> ~/mail/$ml
endif
set attop = 0
echo "From swb@fake.tn.cornell.edu Fri Jan 1 12:00:00 1980" >> ~/mail/$ml
cat ~/Mail/$mh/$msg >> ~/mail/$ml
end
echo "" >> ~/mail/$ml
echo ""
end
ziegast@ENG.UMD.EDU (Eric Ziegast) (11/15/90)
Francois Felix INGRAND writes: > >I have just installed MH but I have not tried it yet. Before I do anything >foolish, I was wondering how difficult it is to convert my 50 unix-mail folder s >to MH format... and how difficult it would be to convert them back (in case I >decide MH is not for me). The command inc(1) will INCorperate your unix-mail in MH folders. If you want, you can even specify different names for each folder: inc +mh-folder1 -file unixmail-folder-1 inc +mh-folder2 -file unixmail-folder-2 I'm not sure what the default for inc is, but to be safe, if you want to keep your unixmail folders to not be deleted when inc reads it, add the option "-notruncate" on the end. If you feel uncomfortable with using MH, try looking at some of the tutorial documents in your mh-6.7/papers directory. As for MH --> unix-mail, there is no standard way to convert them back. But, a few times people responded with some awk scripts that'll convert the messages back to BSD Mail format. I looked through some old print- outs of this newsgroup and couldn't find them. Could someone repost the solution? While you could always mail yourself the message again to recieve it into a unixmail spool folder, I don't see why people really need to convert messages back to unixmail format. I find that once people start using MH, they don't switch back to Mail. (Anyone disagree?) >Is there a list of FAQ about MH somewhere I could consult? Something like this might be worthy of including with the MH distribution in the miscellany directory. Then again, maybe not. This group has been pretty good at answering questions. ________________________________________________________________________ Eric W. Ziegast, University of Merryland, Engineering Computing Services ziegast@eng.umd.edu - Eric@[301.405.3689]
jf@ap.co.umist.ac.uk (John Forrest) (11/15/90)
With a bit of care, you can use "inc" go to from mbox format to folders, and use pack to get back again. John Forrest Dept. of Computation UMIST.
zorn@cutter.lbl.gov (Manfred D. Zorn) (11/16/90)
In article <9011150438.AA01694@bacchus.eng.umd.edu>, ziegast@ENG.UMD.EDU (Eric Ziegast) writes: |> |> The command inc(1) will INCorperate your unix-mail in MH folders. |> If you want, you can even specify different names for each folder: |> |> inc +mh-folder1 -file unixmail-folder-1 |> inc +mh-folder2 -file unixmail-folder-2 |> At least on our system inc does not do what Eric suggested. inc expects individual messages separated by 4 Cntrl-A s. But with a little gawk script you can scan through your old mail file and generate perfect MH "single-message-in-a-single-file" files. |> As for MH --> unix-mail, there is no standard way to convert them back. |> But, a few times people responded with some awk scripts that'll convert |> the messages back to BSD Mail format. I looked through some old print- |> outs of this newsgroup and couldn't find them. Could someone repost |> the solution? |> This conversion is somewhat easier since MH provides packf to pack MH files in a folder into a single file. See documentation for details. Of course you must get rid of the 4 Cntrl-A that packf inserts in between the messages. But that's straightforward. Following are 2 awk scripts: --------------------------------------------------- # needs gawk because awk allows only 10 open files # to unpack mail files into separate files for mh # M. Zorn 1990-11-08 BEGIN { FILE = 0 } /^From / { close(FILE); FILE++ } { print > FILE } --------------------------------------------------- your outgoing mail does not have a date line ( at least mine) to translate to MH it needs the date. You can get it from the "From" line: # add date line to old mail /From / {print printf("Date: %s %s %s %s %s \n",$3, $4, $5, $6, $7) } !/From / {print} ---------------------------------------------------
schmitz@hpscdc.scd.hp.com (John Schmitz) (11/17/90)
Here's a short script that usually does the MH->unix mail conversion quite well (I didn't write this - might have been rsalz?): #! /bin/sh ## MHtoMT. MH to UnixMail conversion. Example: ## MHtoUM personal ## Reads all messages in MH directory ./personal, and creates the ## Unix Mail folder ~/F/personal. ## Assumes everything else has been cleaned out but MH folders. X="`date | sed -e 's/^... //'`" F=$HOME/F cd $HOME/Mail for D in ${1-*} ; do if [ ! -d ${D} ] ; then echo Skipping ${D} -- not a directory continue fi cd ${D} for I in `ls | grep -v '[^0-9]' | sort -n` ; do T=`grep '^Date:' <${I} | head -1` Z=`echo $T | sed -e 's/Date:[^,]*, //' -e 's/Date: //'` # echo $I Date is @"$Z"@ >&2 if [ -z "${Z}" ] ; then Z="${X}" fi echo "" grep -v '^Replied:' <$I | \ sed -e "/Return-Path:/s=\$= ${Z}=" -e "/Return-Path:/s//From /" done >${F}/${D} cd .. done
ziegast@ENG.UMD.EDU (Eric Ziegast) (11/17/90)
"Manfred D. Zorn" writes: >In article <9011150438.AA01694@bacchus.eng.umd.edu>, ziegast@ENG.UMD.EDU >(Eric Ziegast) writes: >|> >|> The command inc(1) will INCorperate your unix-mail in MH folders. >|> If you want, you can even specify different names for each folder: >|> >|> inc +mh-folder1 -file unixmail-folder-1 >|> inc +mh-folder2 -file unixmail-folder-2 >|> > >At least on our system inc does not do what Eric suggested. >inc expects individual messages separated by 4 Cntrl-A s. >But with a little gawk script you can scan through your old mail file >and generate perfect MH "single-message-in-a-single-file" files. In the system's mtstailor file, are there any entrys like: mmdelim1: \001\001\001\001\n mmdelim2: \001\001\001\001\n The man page for mh-tailor(5) says that these options specify: mmdelim1: \001\001\001\001\n The beginning-of-message delimiter for maildrops. mmdelim2: \001\001\001\001\n The end-of-message delimiter for maildrops. It might be worth looking into. ________________________________________________________________________ Eric W. Ziegast, University of Merryland, Engineering Computing Services ziegast@eng.umd.edu - Eric@[301.405.3689]