Skip to content

Instantly share code, notes, and snippets.

@brainstorm
Last active August 29, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brainstorm/de2904e0807c0f436d0b to your computer and use it in GitHub Desktop.
Save brainstorm/de2904e0807c0f436d0b to your computer and use it in GitHub Desktop.
piperget.sh: Fetching pipermail gzipped archives and converting them to .mbox format
#!/bin/sh
# Usage: piperget.sh https://mail.nmr.mgh.harvard.edu/pipermail/freesurfer/
# automated retrieval of pipermail archives & conversion to mbox file
# Last edit: 2012/10/09 Tue 23:16 PDT
listname=$(echo "$1" | sed 's:^\(http.*\)/\([^/]*\)/$:\2:')
cd /tmp
wget -r -l 1 -nH -A *.txt.gz "$1"
touch /tmp/pipermail/$listname/$listname.mbox
chmod 600 /tmp/pipermail/$listname/$listname.mbox
cd /tmp/pipermail/$listname
for f in $(ls |sort)
do gzcat $f | iconv -f iso8859-15 -t utf-8 | sed 's/\(^From.*\)\ at\ /\1@/' >> "$listname.mbox"
done
#rm /tmp/pipermail/$listname/*.gz
mutt -f /tmp/pipermail/$listname/$listname.mbox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment