--- trunk/mailman2mbox.sh 2006/04/10 16:53:25 21 +++ trunk/mailman2mbox.sh 2008/10/21 22:58:11 91 @@ -6,15 +6,35 @@ fi url=$1 +name=`echo $url | sed -e 's!^.*/pipermail/!!' -e 's!/!!g'` -wget="-N -nd -nH" +if [ -e $name ] ; then + echo "$name allready exists!" + exit 1 +fi + +wget="-nd -nH --no-check-certificate" + +dir=/tmp/$name -wget $wget $url +mkdir $dir || exit +cd $dir -echo -n > mbox +echo "*** download $url to $dir" -grep txt.gz index.html | cut -d\" -f2 | while read file ; do +wget -O index.html $wget $url + +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 + wget -N $wget "$url/$file" + 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"