Tuesday, April 14 2009

“This. Is. My. BROOMSTICK!”

#!/bin/bash
cd deferred
find . -type f | split
for i in xa*; do
    for j in $(cat $i); do
        echo -n "$j " #literal tab
        postcat $j | awk '
            /^From: / {f=$0}
            /^To: / {t=$0}
            /^Subject: / {s=$0}
            END {printf("%s\t%s\t%s\n",f,t,s)}'
    done >> /tmp/jfoo
done

Open in Excel, sort to taste, cleanup as needed, save for later use…