#!/bin/sh # mailabstract - print summary of single email message # assumptions: email message is in a single file # requires: emailbody http://www.hut.fi/~tkarvine/emailbody/, # 0.1 (c) 2004-08-08 Tero Karvinen http://www.iki.fi/karvinen # GPL GNU General Public License v2 MSG=$1 BODYCHARS=`echo '79*3'|bc` # 79 chars * 3 lines SUBJ=`cat $MSG|head -100|tr -d '\r'|grep '^Subject:'|sed 's/^Subject:\s*//'` FROM=`cat $MSG|head -100|tr -d '\r'|grep '^From:'|sed 's/^From:\s*//'` FROM=`echo $FROM|tr '[\t ]' '\n'|tr -d '<>'|grep '@'|tr '\n' ' '` #DATE=`cat $MSG|head -25|grep '^Received:'|sed 's/^Received:\s*//'` # print it echo -e "* $SUBJ - $FROM $DATE" cat $MSG|emailbody|tr '\n' ' ' |head -c $BODYCHARS echo