procmail
[Top] [All Lists]

Re: maintaining list

1998-02-22 11:25:54
Ok I did the following:

VERBOSE=off
LOCKFILE=.procaddresses$LOCKEXT
TMP=/staff/mholmes/.procmail/tmp/$$.procaddresses
DUMMY=`cp .procaddresses $TMP`

:0cwh
| formail -rtzxTo: | cat - $TMP |
  tr '[A-Z]' '[a-z]' | sort -u >.procaddresses

DUMMY=`rm -f $TMP`
LOCKFILE=

:0c
* ^TOsupport-staff
/staff/mholmes/mail/supportmail


And it doesn't work. I don't end up with a .procaddresses when someone
sends me mail.


Marcus Holmes                           mholmes(_at_)world(_dot_)std(_dot_)com  
                
Software Tool & Die                     http://www.nitrogen.org 




On Sun, 22 Feb 1998, era eriksson wrote:

On Sun, 22 Feb 1998 08:08:47 -0500 (EST), Marcus Holmes
<mholmes(_at_)world(_dot_)std(_dot_)com> wrote:
 > :0c Wh:
 > | formail -xFrom: >> .procadd
 > | cat -u .procadd > .procsort

One: This is a syntax error. You can have exactly one action per
recipe.

Two: You don't need temporary files for the intermediate results
because Unix pipes do precisely what you need. That also neatly solves
your problem of doing many things in sequence, although you still need
one temporary file (Unix pipelines which attempt to overwrite one of
the input files tend to work badly :-) and a regional lockfile:

    LOCKFILE=.procaddresses$LOCKEXT
    TMP=/tmp/$$.procaddresses
    DUMMY=`cp .procaddresses $TMP`

    :0cwh
    | formail -zxFrom: | cat - $TMP | \
      tr A-Z a-z | sort -u >.procaddresses

    DUMMY=`rm -f $TMP`
    LOCKFILE=

Three: The stuff produced by formail -xFrom: can contain arbitrary
comments which you probably want to reduce away. One commonly seen
trick is to reduce all correspondents' address information to just the
actual address part is to have formail generate a reply, whcih
incidentally will only contain the address (e-mail terminus) and then
use that instead:

    :0cwh
    | formail -rtzxTo: | cat - $TMP | 
      tr '[A-Z]' '[a-z]' | sort -u >.procaddresses

(The rest of the recipe as above, obviously.)

If you're interested in understanding the formail trick used here, the
FAQ attempts to explain it a little bit better (but not much). Visit
<http://www.iki.fi/~era/procmail/mini-faq.html>

/* era */

Never underestimate the importance of removing temporary files when
you're done.

-- 
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>


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