home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / mirror / MailDrop / Eudora2MD.pl < prev    next >
Perl Script  |  1997-10-26  |  1KB  |  78 lines

  1. #!/usr/local/bin/perl 
  2.  
  3.  
  4.  $f=$ARGV[0];
  5.  
  6.  
  7.  
  8. open (FILE,"$f");
  9. open (FILEout,'>addresses.dat');
  10.  
  11. #@z ist das geoeffnete File als Array
  12.  
  13.  
  14.  
  15.  
  16. while (@z = <FILE>) {
  17.  
  18.  
  19.  # $#z is last element of array @z as scalar var
  20.  
  21.    for ($u=0;$u<=$#z;$u ++) 
  22.  
  23.    {
  24.  # deletes all strings "alias" 
  25.  $z[$u]=~s/alias //g;
  26.  
  27. #if there are notes, they are removed here
  28. $z[$u]=~s/note.*\s//g;
  29.          
  30. #xxx will be met as dummytext for sorting 
  31.          $z[$u]=~s/(^\w.*)(\w.*,.*)/xxx$1$2/;
  32.  
  33.          #search for groups
  34.          $z[$u]=~s/([\w]*) ([A-Za-z0-9_@]*,.*)/$1 GROUP@GROUP\nnoname $2/g;
  35.          }
  36.  
  37. # Sorting of the Array -> Groups are at the end of the File 
  38. @gaga =sort @z;
  39.  
  40. for ($v=0;$v<=$#gaga;$v ++) 
  41.  
  42.      {
  43.  
  44.      # Remove xxxx
  45.      $gaga[$v] =~s/xxx//g;
  46.  
  47.      #Split groups after member nbr. 2 
  48.      
  49.  
  50. $gaga[$v] =~s/(,)/\nnoname /g;
  51.  
  52.  
  53.  
  54.  
  55.      #Put bracket around eMailaddresses 
  56.      $gaga[$v] =~s/([A-Za-z0-9_]*) (.*)/$1 <$2>/g;
  57.      }
  58.  
  59. #Zeigt das Array @gaga am Bildschirm (optional)
  60. #print @gaga;
  61.  
  62. # Writes the new File with  Filehandle FILEout
  63. print FILEout @gaga;
  64.  
  65.  
  66. }
  67.  
  68. #Closes the file with the Handle "FILE" and FILEout
  69. close (FILE);
  70. close (FILEout);
  71. # schliesst das Programm, (1) schliesst das Programm nur als
  72. # Droplet oder Runtimeversion
  73.  
  74.  
  75.  
  76.  
  77. &MacPerl'Quit(2);
  78.