procmail
[Top] [All Lists]

Re: The Safe backup in procmailex

1997-05-29 13:05:00
On Thu, 29 May 1997 14:58:45 +0000 (GMT),
"Matthew G. Saroff" <msaroff(_at_)pca(_dot_)net> wrote:
     The safe backup in the procmailex man page is:#this will put a 
copy of all messages in a fallback folder.  It is a safety
# feature for when I implement new recipes.  This will save only the most 
# recent 32 messages
:0 c
backup
:0 ic
|cd backup && rm -f dummy `ls -t msg.* | sed -e 1,32d`
     Does anyone out there have a variant of this that might keep the 
last N messages in a mail folder as opposed to separate files?  It would 

That is going to be fairly complicated. However, if your system is
good about quoting From_ lines, you could approximate it with a sed
script which will always pluck off the first message from the folder:

    sed -e '1d' -e '2,/^From /{' -e '/^From /!d' -e '}'

Lars Kellogg-Stedman posted instructions for how to use MH folders
from within Pine some time ago (a week or two); that would allow you
to read a directory of files from Pine, I believe. (I understand MH
uses a one file per message format.)

[The script is only briefly tested and I'm no sed guru. YMMV.]

Hope this helps,

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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