Created
December 21, 2016 10:27
-
-
Save tluyben/579055c2f6c73a56a22733a15cd3714a to your computer and use it in GitHub Desktop.
Getting out the emails from a email client list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
@d = split(/\;/,`cat mailinglist.txt`); | |
print "Email\tFirst\tLast\n"; | |
foreach(@d) { | |
chomp; | |
$s = $_; | |
$s =~ s/^\s+|\s+$//g; | |
if ($s=~/(.*?)\s*\((.*?)\)/igsm) { | |
$e = $2; | |
($f,$l) = $1=~/(.*)\s+(.*)$/; | |
$f = $1 if !$f; | |
($f) = $f=~/(.*)\@/ if $f eq $e; | |
print "$e\t$f\t$l\n"; | |
} else { | |
($f) = $s=~/(.*)\@/; | |
print "$s\t$f\t\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment