[NCUC E-team] Mailing lists

Tapani Tarvainen ncuc at tapani.tarvainen.info
Mon Jan 21 21:38:10 CET 2013


On Sun, Jan 20, 2013 at 11:46:05AM +0200, Tapani Tarvainen (ncuc at tapani.tarvainen.info) wrote:

> I actually created ncuc-members list already, but hid
> it from the above as it's not functional yet - I just wanted
> to test importing archives from Syracuse listserv.

FYI, I'm going to trash it before someone stumbles on it
and thinks it's real. Chances are we'll want to use another
name (like ncuc-discuss), and in any case I'd have to rebuild
the archive once the cutoff point is decided.

But, just for the sake of documentation, I'll attach the
script I whipped together to convert LISTSERV archives
into Mailman-friendly form, even though it's just a quick
and ugly hack.

-- 
Tapani Tarvainen
-------------- next part --------------
#! /bin/bash -e
# Time-stamp: <listserv2mailman  2013-01-19 20:27:14  tt>

# Quick hack to convert LISTSERV archives for Mailman
# Tapani Tarvainen 2013-01-19

# Assume LISTSERV digests as returned by GET LOG... commands
# and saved as such in mbox format, convert into form suitable
# for Mailman (mbox format with individual messages).

# discard headers which aren't part of the archived messages
sed '/^From /,/^$/d' "${1:-NOFILE}" > y

# extract individual messages
csplit y "/^=========================================================================/" "{*}"

# re-generate headers LISTSERV has munged up
# and bundle the messages back together
for i in xx*; do

[ -s $i ] || continue # ignore empty files

# build mbox format separator line like this:
# From x at x  Day Month dd HH:MM:SS YYYY
# and conventional To: -field from LISTSERV-munged header
from=$(sed -n '/^From:/{s/^.*<//;s/>.*//;p;q;}' $i)
date=$(date --date "$(sed -n '/^Date:/{s/^Date: *//;p;q;}' $i)")
sender=$(sed -n '/^Sender:/{s/^.*<//;s/>.*//;p;q;}' $i)

echo "From $from $date"
echo "To: $sender"
# discard separator line
sed '1{/^===============================/d;}' $i

done >mailman.mbox
# ready for processing with ...mailman/bin/arch (or mmarch, qv.)

# discard temporary files
rm y xx*


More information about the E-team mailing list