Skip to content

Instantly share code, notes, and snippets.

@tluyben
Created December 21, 2016 10:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tluyben/579055c2f6c73a56a22733a15cd3714a to your computer and use it in GitHub Desktop.
Save tluyben/579055c2f6c73a56a22733a15cd3714a to your computer and use it in GitHub Desktop.
Getting out the emails from a email client list
#!/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