procmail
[Top] [All Lists]

RE: procmail blues: half-shod solution...

2002-12-30 18:06:35
poff(_at_)sixbit(_dot_)org [mailto:poff(_at_)sixbit(_dot_)org] wrote:

[dman what written:]

    :0  # inside the square braces are a caret and a space.
    * ^^From \/[^ ]+
    { FROMADDR = $MATCH }

I have some questions on your syntax here, I've tried comparing it to
sed/perl regular expressions but I can't!

Sean Straw answered already, but I will try to restate a couple of
things
for another perspective on understanding.  Sean is correct, though, that

you should first be reading the various procmail man pages, most
particularly, 
`man procmailrc', `man procmailex', and `man procmail'.  You should have

found the match token `\/' there.  (And, like Sean, I wondered if you
really had not read his reply, which also worked and which preceded
mine.
Mine was simply commentary on his.)


If I understand:

^^From = searches the first line (or first instance?) of what 
comes after From

Close, but your wording is imprecise, so I can't tell if you understand.
`^^' is a special token in procmail.  It means "the start of the area
being considered."  Since we are on a standard condition line of a
regular
procmail recipe that has no nonstandard flags in its instantiating line,
then the area being considered is the message headers.  So "^^From "
means the front of the top header in the message -- and if it's in
(Berkeley) Mail format, the top line had better start with "From ",
with a space.

\/ something = remove that something?

Again, Sean answered, and it's in the man pages, and it's in the list
archived a gazillion times.  It's the procmail "match token."  What's
to the right gets saved to the temp string variable $MATCH.  The
token is atomic -- the `\' cannot be separated from the `/' or we
no longer have this special token, but rather, some literal slashes.


[^ ] = starts with one space

No, and Sean went deep into this one: "NOT-a-space".

+ = save the rest of this??

No, and, as Sean said: one or more instances of what preceded the
character, i.e., one or more instances of NOT-a-space.


It's just that I've being trying to decode this (I searched 
and couldnt find any good tuts on this) so I can do a similar 
thing and extract the domain without using awk or formail...

I got as far as:

:0
* ^^From \/[^ ]\/(.*)@+
{ DOMAIN = $MATCH }

You won't get far with multiple match tokens on a line.

-- 
        "Weltbedenkend, ortlich lenkend!"
                -- Original von Dallman Ross


_______________________________________________
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>