From: sullivan@Semi.Mitel.COM (Mike Sullivan)
Newsgroups: comp.mail.elm
Subject: Re: converting VMS MAIL folder to elm
Date: 15 Dec 92 17:27:29 GMT
Organization: Mitel. Kanata (Ontario). Canada.

In article <johnson.3.724125554@kelvin.jpl.nasa.gov>, johnson@kelvin.jpl.nasa.gov (Glenn Johnson) writes...
# 
#Is there a way to convert VMS MAIL folders to elm format?
#(Preserving the dates and original sender etc.)


We whipped up a little shell/awk script and brute forced it. I didn't
write it, but here it is....

*** QUICK HACK ALERT - BUGS POSSIBLE ***
--------cut here--------------
#! /bin/sh
for i in $*
do
	gawk '
            BEGIN { FS = " " }                                 
                  {                                                  
                   if ( $1 == "\f" )                                 
                      { record = NR+1 }                              
                   if ( (NR == record) && ($1 == "From:") )          
                      { printf( "\nFrom ")                          
                       if ( (substr($2,5,2)) == "::" |(substr($2,5,1)) == "%" )    
                            { Mon = substr($(NF-1),4,3) 
                              Day = substr($(NF-1),1,2)
                              Year = substr($(NF-1),8,4)
                              Time = substr($NF,1,8)
                              printf("%s", substr($2,7,length($2)))
                            if ( length($(NF-1)) == "10" ) 
                             {Mon = substr($(NF-1),3,3)
                              Day = substr($(NF-1),1,1)
                              Year = substr($(NF-1),7,4)}   
                         if (Mon == "JAN")
                            {Mon = "Jan"}  
                         if (Mon == "FEB")
                            {Mon = "Feb"}  
                         if (Mon == "MAR")
                            {Mon = "Mar"}  
                         if (Mon == "APR")
                            {Mon = "Apr"}  
                         if (Mon == "MAY")
                            {Mon = "May"}  
                         if (Mon == "JUN")
                            {Mon = "Jun"}  
                         if (Mon == "JUL")
                            {Mon = "Jul"}  
                         if (Mon == "AUG")
                            {Mon = "Aug"}  
                         if (Mon == "SEP")
                            {Mon = "Sep"}  
                         if (Mon == "OCT")
                            {Mon = "Oct"}  
                         if (Mon == "NOV")
                            {Mon = "Nov"}  
                         if (Mon == "DEC")
                            {Mon = "Dec"}  
                        printf(" Mon %s %s %s %s\n", Mon, Day, Time, Year ) 
                        } 
                       if ((NR == record) && (NF == "7"))
                          {
                            for (i = 2; i<(NF+1); i++)
                             {printf("%s ", $i)}
                            printf("\n")
                          }
                       }  
                       if ( NR == record && $1 != "From:")              
                        {printf("\n\f"); print $0  }    
                       if ( NR <= record+3 && $1 == "Subj:" ) 
                         {
                          srecord = NR
                          printf("Subject: ")
                            for (i = 2; i<(NF+1); i++)
                                 { printf("%s ", $i) }
                          printf("\n")
                         }             
                       if ( NR != record && $1 != "\f" && NR != srecord)                 
                        {print $0 }                                  
                  }                     
	' < $i > ~/newdir/$i
done
--------cut here--------------

Save in a file called convmail, and then allow it to be executed with
the command "chmod 755 convmail". Then just type "convmail *" and away
it goes, putting the new files in "newdir".


-- Mike Sullivan --                  -- Information Technology Group --
Fax: (613)592-4784                        Voice: (613)592-2122 Ext.3570
Mike_Sullivan@Mitel.COM       Mitel Corporation, Semiconductor Division
Effective use of available technology for better information management


Newsgroups: comp.mail.elm