removing mbox duplicates

Due to a snafu over the weekend my inbox (and every other folder) managed to get about 15 copies of every single message. Luckily it's easy to get rid of duplicates with formail (part of the Debian procmail package).

#!/bin/sh
formail -D 1000000 idcache < $1 -s > $1.tmp && mv $1.tmp $1
rm idcache