wengland@stephsf.stephsf.com (Bill England) (01/29/91)
Heres a Perl program I just hacked this afternoon to convert an alumni list an former prof of mine mailed me. I don't work on Vax'en but others who get Vax'en mailing lists might want to convert them to somting usefull (and readable ;-) ) If anyone has a chance to enhance my edits please feel free. (Hint, Hint) ___ vax_to_mmdf ___ #! perl ## # Created by Stephen Software Systems, Inc. 1991 # # This work is public domain and may be freely copied, modified, # and distributed. # # The purpose of this program is to convert those complex and messy # looking VAX mail lists into a cleaner looking mmdf, Internet # format. # # While this program is set up to run in a Unix environment # some simple modifications should allow it to run on a VAX # with the Perl 3.0 patchlevel 44 release. ( You may have to # do without the nifty sorting provided by sort. ) # # This program is distributed WITHOUT ANY WARRANTY and without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. # # Bugs: # If some strange bang routing is declared it assignes the # closest system a domain name of uucp. This might work # for sites close to uunet but, is probally incorrect for # many sites. # # If it does not work try to get the site to send in a map # to the rutgers mapping project. Or correct the VAX'en list # used for input. # # This also does not work on multiple bang routings. # # # # # # This software system is currently under construction/design/hack, # Please don't mind the mess :-) ... # # Formatting Notes: # 80 column width, 4 space tabs. # # Modification Notes; # # Created: # Bill England, Mon Jan 28 20:14:08 PST 1991 # # Please send problems, enhancements, and corrections to # support@stephsf.COM ## eval "exec perl -S $0 $*" if $running_under_some_shell; # format SORT_OUT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< (@<<<<<<<<<<<<<<<<<<<<<<) $e_mail, $name . # open(SORT_OUT, "|sort -t@ -u +2 -3 +1 -2"); # while(<>){ chop; ($junk, $rest) = split(/%"/); $rest =~ y/ / /; # replace tab with space $rest =~ y/"/ /; @add_name = split(/!/, $rest); foreach (@add_name){ s/^( +)//eo; # ditch leading and trailing spaces s/( +)$//eo; y/[\(\)]/-/; # replace any parrens with a -, () denote comments # for the mail header standards. 0 while s/ /' '/eo; # reduce 2spaces to 1space. } $name = pop(@add_name); ## Special logic to get rid of system specific routing. # gives unknown domain names a uucp domain. # if (@add_name > 1){ ($e_mail,$junk) = split(/@/, $add_name[1]); $e_mail .= '@'; $e_mail .= "$add_name[0].uucp"; }else{ # otherwise simply join the remaining array back together. $e_mail = join('!', @add_name); } $e_mail =~ y/[A-Z]/[a-z]/; # Change mail address to all lower case write SORT_OUT; } close(SORT_OUT); -- +- Bill England, wengland@stephsf.COM -----------------------------------+ | * * H -> He +24Mev | | * * * ... Oooo, we're having so much fun making itty bitty suns * | |__ * * ___________________________________________________________________|