procmail
[Top] [All Lists]

Re: egrepping only first occurrence

1996-03-22 16:22:24
dattier(_at_)wwa(_dot_)com (David W. Tamkin) writes:
...
 # If the body has more than one occurrence of ^From:, procmail will
 # extract the MATCH on the earliest one it finds.
 :0B
 * ^\/From:.*
 FROM=$MATCH

You forgot the braces.

:0B
* ^\/From:.*
{ FROM=$MATCH }

Stephen caught me once on that too.


...
If what you needed had been the *last* From: line in the body, it wouldn't
have been nearly so straightforward.


Yes it would be!

:0B
* 1^1 ^\/From:.*
{ FROM=$MATCH }

The scoring forces procmail to find all the matches, which leaves the
last in $MATCH.


Philip Guenther

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