home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / mail / elm / 3762 < prev    next >
Encoding:
Text File  |  1992-12-16  |  4.4 KB  |  103 lines

  1. Path: sparky!uunet!cs.utexas.edu!torn!nott!cunews!revcan!Semi.Mitel.com!sullivan
  2. From: sullivan@Semi.Mitel.COM (Mike Sullivan)
  3. Newsgroups: comp.mail.elm
  4. Subject: Re: converting VMS MAIL folder to elm
  5. Message-ID: <13727@einstein>
  6. Date: 15 Dec 92 17:27:29 GMT
  7. References: <johnson.3.724125554@kelvin.jpl.nasa.gov> <12DEC199200223994@spades.aces.com>
  8. Organization: Mitel. Kanata (Ontario). Canada.
  9. Lines: 92
  10.  
  11. In article <johnson.3.724125554@kelvin.jpl.nasa.gov>, johnson@kelvin.jpl.nasa.gov (Glenn Johnson) writes...
  12. #Is there a way to convert VMS MAIL folders to elm format?
  13. #(Preserving the dates and original sender etc.)
  14.  
  15.  
  16. We whipped up a little shell/awk script and brute forced it. I didn't
  17. write it, but here it is....
  18.  
  19. *** QUICK HACK ALERT - BUGS POSSIBLE ***
  20. --------cut here--------------
  21. #! /bin/sh
  22. for i in $*
  23. do
  24.     gawk '
  25.             BEGIN { FS = " " }                                 
  26.                   {                                                  
  27.                    if ( $1 == "\f" )                                 
  28.                       { record = NR+1 }                              
  29.                    if ( (NR == record) && ($1 == "From:") )          
  30.                       { printf( "\nFrom ")                          
  31.                        if ( (substr($2,5,2)) == "::" |(substr($2,5,1)) == "%" )    
  32.                             { Mon = substr($(NF-1),4,3) 
  33.                               Day = substr($(NF-1),1,2)
  34.                               Year = substr($(NF-1),8,4)
  35.                               Time = substr($NF,1,8)
  36.                               printf("%s", substr($2,7,length($2)))
  37.                             if ( length($(NF-1)) == "10" ) 
  38.                              {Mon = substr($(NF-1),3,3)
  39.                               Day = substr($(NF-1),1,1)
  40.                               Year = substr($(NF-1),7,4)}   
  41.                          if (Mon == "JAN")
  42.                             {Mon = "Jan"}  
  43.                          if (Mon == "FEB")
  44.                             {Mon = "Feb"}  
  45.                          if (Mon == "MAR")
  46.                             {Mon = "Mar"}  
  47.                          if (Mon == "APR")
  48.                             {Mon = "Apr"}  
  49.                          if (Mon == "MAY")
  50.                             {Mon = "May"}  
  51.                          if (Mon == "JUN")
  52.                             {Mon = "Jun"}  
  53.                          if (Mon == "JUL")
  54.                             {Mon = "Jul"}  
  55.                          if (Mon == "AUG")
  56.                             {Mon = "Aug"}  
  57.                          if (Mon == "SEP")
  58.                             {Mon = "Sep"}  
  59.                          if (Mon == "OCT")
  60.                             {Mon = "Oct"}  
  61.                          if (Mon == "NOV")
  62.                             {Mon = "Nov"}  
  63.                          if (Mon == "DEC")
  64.                             {Mon = "Dec"}  
  65.                         printf(" Mon %s %s %s %s\n", Mon, Day, Time, Year ) 
  66.                         } 
  67.                        if ((NR == record) && (NF == "7"))
  68.                           {
  69.                             for (i = 2; i<(NF+1); i++)
  70.                              {printf("%s ", $i)}
  71.                             printf("\n")
  72.                           }
  73.                        }  
  74.                        if ( NR == record && $1 != "From:")              
  75.                         {printf("\n\f"); print $0  }    
  76.                        if ( NR <= record+3 && $1 == "Subj:" ) 
  77.                          {
  78.                           srecord = NR
  79.                           printf("Subject: ")
  80.                             for (i = 2; i<(NF+1); i++)
  81.                                  { printf("%s ", $i) }
  82.                           printf("\n")
  83.                          }             
  84.                        if ( NR != record && $1 != "\f" && NR != srecord)                 
  85.                         {print $0 }                                  
  86.                   }                     
  87.     ' < $i > ~/newdir/$i
  88. done
  89. --------cut here--------------
  90.  
  91. Save in a file called convmail, and then allow it to be executed with
  92. the command "chmod 755 convmail". Then just type "convmail *" and away
  93. it goes, putting the new files in "newdir".
  94.  
  95.  
  96. -- Mike Sullivan --                  -- Information Technology Group --
  97. Fax: (613)592-4784                        Voice: (613)592-2122 Ext.3570
  98. Mike_Sullivan@Mitel.COM       Mitel Corporation, Semiconductor Division
  99. Effective use of available technology for better information management
  100.  
  101.  
  102.