#!/bin/csh -f # h1: chops the head off mail files rm -f top1 top2 foreach i ($*) if(-f ${i}) then sed -e '1,/^$/\!d' ${i} > top1 cat top1 |grep ^From: > top2 cat top1 |grep ^Subject: >> top2 cat top1 |grep ^Date: >> top2 cat top1 |grep ^To: >> top2 if(-z top2) then echo this is not mail file goto saigo endif echo "" >> top2 sed -e '1,/^$/d' ${i} >> top2 mv -f top2 ${i} saigo: rm -f top1 top2 endif end