procmail
[Top] [All Lists]

Re: bad clams?

2002-07-29 13:02:43
On Sun, 28 Jul 2002, David W. Tamkin wrote:

| The message that got misrouted is in a text file called "message."
|
| $ procmail * ()\/bk.ru message
| or
| $ procmail -m ()\/bk.ru message (doesn't look like the -m synopsis)
| or
| $ procmail "bk.ru" message
|
| ?????

Procmail does not support having recipe code on the command line; it has to be
in a file.  So you create a new rcfile -- let's call it .frogrc and put it
into $HOME.  It should look something like this:

 LOGFILE=$HOME/.froglog
 DEFAULT=$HOME/tadpoles # for messages that are not full-fledged frogs
 VERBOSE=on

 :0:
 * ()\/(that\.long|list\.of|\
      do\.mains|you\.have)
 frogs

Then, back at the shell prompt,

 procmail .frogrc < message

and then you read $HOME/.froglog to see what text was assigned to MATCH.



        To test matching strings I have a lazy version of David's rc:
        I have a short file, named testrc:

VERBOSE=on
:0 B
* ()\/.+
/dev/nul

        And I have alias (in bash):

alias pmtest='formail -s procmail testrc 2>&1 | grep ": M"'

        Or in [t]csh:

alias pmtest 'formail -s procmail testrc |& grep ": M"'


        Now, the command:

echo "From: helllllllooo" | pmtest

        Will show you how procmail see the string.

        You can play in two places:  First you can feed the alias with
        different input by the echo(1) command, and in the second place
        you can change the right side of the "\/" in the testrc file
        (just like David's way).

        About the grep.  The word "egrep" appears in procmailrc 11 times
        while the word grep only one time(*).  so, learn the egrep(1) man
        instead of grep(1).  Example how to play with egrep(1) from the
        command line:

echo "TO xyz.zoo" | egrep 'xyz*zoo'

        If egrep(1) matches something it will answer you.

Bye,
 Udi

(*)  Whene newbie reads the procmailrc man it's to be expected that he
     remember the "egrep" instead of "grep":

yarkon~% man procmailrc | tr ' ' '\012' | grep '\<.*grep' | wc -l
      11
yarkon~% man procmailrc | tr ' ' '\012' | grep '\<grep' |  wc -l
       1
yarkon~%

        This is recursive example how to grep info from the man with
        out reading the man  (;-)


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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