Hi,

On Thu, 09 Oct 2014, Holger Wansing wrote:
> The ideal case would be, if you could write some kind of script, which
> extracts the mail addresses from the consultant.data file, so that sending
> mails to all consultants would be easy. So if you have programming skills,
> that would be a real help! (hmm, maybe Raphael has something ready for that?)

I have written something like that yes. See the attached perl script.

You need to run it while in webwml/english/consultants/.

Cheres,
-- 
Raphaël Hertzog ◈ Debian Developer

Discover the Debian Administrator's Handbook:
→ http://debian-handbook.info/get/
#!/usr/bin/perl

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;
        }
}

Reply via email to