Re: mailman import question

Lars Magne Ingebrigtsen <[email protected]> Sat, 07 Oct 2006 15:14:44 +0200
Newsgroups gmane.mail.archives.mail-archive
Message-ID <[email protected]>
"Jeff Breidenbach" writes:

> Thanks, Lars. I don't see the script - could you please resend?

Hm.  Looks like the attachment was stripped?

Here it is again:

#!/usr/bin/perl

$url = $ARGV[0];
$compressed = $ARGV[1];

unlink "/tmp/piper-complete.txt";

if ($compressed) {
    $suffix = "txt.gz";
} else {
    $suffix = "txt";
}

system("wget", "--no-check-certificate", "-O", "/tmp/piper", $url);

open(PIPER, "/tmp/piper") || die;

while (<PIPER>) {
    $files[$i++] = $1 if /"(.*.$suffix)"/;
}

close PIPER;

for (; $i >= 0; $i--) {
    print($files[$i], "\n");
    system("wget", "--no-check-certificate", "-O", "/tmp/piper.$suffix", $url . $files[$i]);
    if ($compressed) {
	system("zcat /tmp/piper.txt.gz | /gmane/fix-piper >> /tmp/piper-complete.txt");
    } else {
	system("/gmane/fix-piper < /tmp/piper.txt >> /tmp/piper-complete.txt");
    }
}

and

fix-piper is the following:

#!/usr/bin/perl

while (<STDIN>) {
    s/^(From:? .*) (at|en) /\1\@/;
    s/^Date: ([A-Z][a-z][a-z]) +([A-Z][a-z][a-z]) +([0-9]+) +([0-9:]+) +([0-9]+)/Date: \1, \3 \2 \5 \4 +0000/; 
    print;
}


-- 
(domestic pets only, the antidote for overdose, milk.)
  [email protected] * Lars Magne Ingebrigtsen

_______________________________________________
Discussion list for The Mail Archive
[email protected]
http://jab.org/cgi-bin/mailman/listinfo/gossip