procmail
[Top] [All Lists]

Re: postprocess a mailbox

1998-08-12 12:04:13
On Wed, 12 Aug 1998 10:50:49 -0700 (PDT), Michael McCaffrey
<herozero(_at_)best(_dot_)com> wrote:
i'm trying to post process a mail box to remove any messages that are not
from August. the mailbox isn't the inbox. all the non-August mail is
removed and ends up in null.inbox (will be changed to /dev/null when i
get this to work) but all the rest of the mail disappears. the shell
script is from the procmail man page and it appears the file .newmail
never gets removed. i think the problem is because i'm using a mailbox
that's not the "inbox" but not sure how to fix it. starting from scratch
would be fine.

The script you copied is useful for dealing with your live inbox, but
unnecessarily complicated for just running Procmail on an old archive
file. The piece of information that is missing from your posting is a
log excerpt. Try something like this (assuming oldbox is a file which
could not have new messages appended to it anymore e.g. by recipes in
your .procmailrc):

    formail -s procmail rcfile < oldbox

where rcfile is something like

    #LOGFILE=somefile   # uncomment to get a log

    :0:
    * ^Date:.*\<Aug\>
    ./keepers

    :0:
    ./otherwise

Anything that is saved to keepers is stuff you want to keep. Anything
else gets saved to otherwise, which can be thrown away along with
oldbox after you're sure everything worked as intended.

You probably don't even need this minuscule locking (second colon in
:0:) but it's good practice to always use locking when writing to an
mbox folder. (And if you run formail -ns, you do need locking.)

Hope this helps,

/* era */

-- 
Bot Bait: It shouldn't even matter whether  (`')  Just  (`')  http://www.iki
I am a resident of the State of Washington   \/ Married! \/   .fi/~era/

<Prev in Thread] Current Thread [Next in Thread>