procmail
[Top] [All Lists]

Re: egrepping only first occurrence

1996-03-23 13:35:35
Philip Guenther caught me:

| >  # 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.

Youch!  So I did.  And I thought I went back and put them in; that must have
been some other place where I made the correction in time.

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

Thanks, Philip.  The braces are necessary.

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

Thank you again; I didn't know that.

David W. Tamkin    dattier(_at_)wwa(_dot_)com    2094393(_at_)mcimail(_dot_)com

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