aboutsummaryrefslogtreecommitdiffstats
path: root/english/consultants/extract-mailaddresses
blob: b100aea0fc3a6c831a3c7216c7f356e44b6ceee9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl
# extract mail addresses from consultant.data
#
# provided by Raphael Hertzog, thanks!

use HTML::Entities;
use open ':encoding(utf8)';

$filename	= 'consultant.data';
$comment	= '^#\s*Consultant:\s*(.*)\s*$';

# Read in file
open( FILE, "<$filename" ) || die "$filename: $!\n";
binmode STDOUT, ":encoding(utf8)";

# Count consultants/countries
while ( <FILE> ) {
	chomp;
	if(/^\s*$/) {
	    if ($email) {
		$name //= $company;
		print STDOUT "$name <$email>\n";
	    }
	    $name = $email = $company = undef;
	}
	$name = decode_entities($1) if (/^<name\s+(.*)>/);
	$company = decode_entities($1) if (/^<company\s+(.*)>/);
	if (/^<email\s*(\S+)(\s+scramble=["']?yes["']?)?>/) {
	    $email = $1;
	    $email = decode_entities($email);
	    $email =~ s/"//g;
	}
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy