Path: utzoo!utgpu!news-server.csri.toronto.edu!qucis!prastowo From: prastowo@qucis.queensu.CA (Bambang Nurcahyo Prastowo) Newsgroups: comp.editors Subject: perl script request Message-ID: <2083@qusunc.queensu.CA> Date: 10 May 91 14:12:42 GMT Distribution: world Organization: Queen's University, Kingston Lines: 49 Could any perl guru help me rewrite the following sh script in perl ? The script is a mail sorter that cleans incoming mails (simplifies headers and removes duplicated blank lines) and save them in mailboxes named after the first words of email addresses appear in "From:...". Bambang Prastowo prastowo@qucis.queensu.ca #! /bin/sh home=/grad/prastowo/MAIL inmail=$home/inmail.$$ outmail=$home/outmail.$$ header=$home/header.$$ body=$home/body.$$ neat=$home/neat.$$ sender=$home/sender.$$ echo=/bin/echo grep=/bin/grep egrep=/bin/egrep rm=/bin/rm sed=/bin/sed cat=/bin/cat awk=/bin/awk tr=/bin/tr $cat > $inmail $sed -n '1,/^$/p' $inmail > $header $sed -n '/^$/,$p' $inmail > $body trap "$rm -f $header $inmail $body $sender $neat" 0 ( $egrep '^From |^From:|^Date:|^Subject:' $header $echo $awk '/^Date:/||/^From:/||/^Subject:/ {printf(">")}{print}' $body $echo _____________________________________ $echo ) | awk '/^[ \t]*$/{if(!b){print "";b=1}}/[^ \t]/{print $0;b=0}'> $neat # keep mails in folders by the 1st words of senders' addresses. sd=`$sed -n 's/^From://p' $header | $sed 's/.*.*//' | $awk '{print $1}' | sed 's/[@%\.\!].*$//' | $tr a-z A-Z ` $cat $neat >> $home/$sd exit 0 -- Bambang Nurcahyo Prastowo prastowo@qucis.queensu.ca prastowo@qucis.bitnet