[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: parsing existing mbox



On Sat, Sep 02, 2000 at 11:23:17AM -0500, Will Trillich wrote:
...
> you've got a mbox with hundreds of messages
> in it, and you've updated your .procmailrc or
> exim.conf with new filtering rules, and you
> wanna run them on your mbox to split it up
> into pieces, perhaps forwarding certain messages
> on to other folks, or deleting those matching
> pattern X.

you could try the script down below, but beware I'm not a guru
and myself I have troubles using formail on the debian-user-digest,
it chops of some attachments it seems (or is that an error of the
digest at debian.org?, never checked it).

You can do without the locking if you do
   # mv mbox mbox.unsorted
   # formail -s procmail <mbox.unsorted

> my failing memory tells me it involved an odd
> option along the lines of "-0f0" or "-f1"...

The big question is ofcourse for which program:)

++++++++++++++++++
# cat sortmail
#!/bin/bash

unset noclobber

ORGMAIL=/var/spool/mail/$LOGNAME #adjust to need
export MAILDIR=~/Mail

if cd $HOME &&
   test -s $ORGMAIL &&
   lockfile -r0 -l3600 .newmail.lock 2>/dev/null
then
   trap "rm -f .newmail.lock" 1 2 3 15
   umask 077
   lockfile -l3600 -ml
   cat $ORGMAIL >>.newmail && cat /dev/null >$ORGMAIL
   lockfile -mu
   formail -s procmail <.newmail && rm -f .newmail
   rm -f .newmail.lock
fi
exit 0
++++++++++++++

-- 
groetjes, carel



Reply to: