--- trunk/mailman2mbox.sh 2007/06/15 20:34:04 40 +++ trunk/mailman2mbox.sh 2007/07/26 17:17:54 41 @@ -6,15 +6,31 @@ fi url=$1 +name=`echo $url | sed -e 's!^.*/pipermail/!!' -e 's!/!!g'` + +if [ -e $name ] ; then + echo "$name allready exists!" + exit 1 +fi wget="-N -nd -nH" -wget $wget $url +mkdir /tmp/$name || exit +cd /tmp/$name -echo -n > mbox +wget -O index.html $wget $url -grep txt.gz index.html | cut -d\" -f2 | while read file ; do +echo -n > $name + +grep \.txt index.html | cut -d\" -f2 | while read file ; do echo "downloading $url/$file" wget $wget "$url/$file" - zcat $file | perl -pe 's/^(From.+?) at (.+)$/$1\@$2/g' >> mbox + if echo $file | grep '\.gz$' >/dev/null ; then + cat=zcat + else + cat=cat + fi + $cat $file | perl -pe 's/^(From.+?) at (.+)$/$1\@$2/g' >> $name done + +echo "Files left in /tmp/$name/$name"