Skip to content

Instantly share code, notes, and snippets.

@brainstorm
Last active Aug 29, 2015
Embed
What would you like to do?
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