2000-06-08-17:20:31 Nathan Torkington: > I redirected mail to an alternate account while my machine was down > lately. To resend all those messages, all I needed was: > > perl -0777 -ne 'for (split /(?=^From )/m) { open(S, "|sendmail gnat\@frii.com"); print S $_ }' $MAIL > > Life with Perl is good. Indeed it is. That's really sexy, and nice to remember. But I gotta confess, when I wanna do this deed, I tend to formail -s sendmail gnat@frii.com <$MAIL formail, which comes with procmail, is pretty darned handy to have around. And that solution is a bit more robust than yours; the string "^From " can occur in some varients and perversions of the mbox format (ones with Content-Length, I believe). On the other hand, I've also [mis]used another tool based on the assumption that '^From ' is guaranteed to be the message separator; when I want to programmatically edit mailboxes, I tend to start by whapping them with csplit -n 6 - '/^From /' '{*}' which carves 'em out into individual messages in individual files. -Bennett