On Wed, 6 Jan 1999 22:52:43 -0700 (MST), Bill McClatchie
<wmcclatc(_at_)primenet(_dot_)com> wrote:
I am re-doing most of my procmail filters; and have been using the
following for most of my mailing lists. How can I eliminate the sed
command?
:0:
* ^From[ ]owner-\/.*@
{
LIST=`echo $MATCH|sed -e 's/@/\.gz/'`
:0 w:
|gzip -fc >> $LIST
}
This can be very hard in the general case, but assuming we can assume
[heh] that there is only going to be one @ in the string (unless you
subscribe to some rather unusually set up lists, nothing should
break), just look for everything non-@ and grab that into MATCH
instead:
:0w:
* ^From[ ]+owner-\/[^(_at_)]+
| gzip -fc >>$MATCH
If you want to verify that there +is+ an @ in the string, and/or
specifically need the $LIST variable to be set after this recipe, you
can do something fairly close to what you already had:
:0 # extraneous locallockfile elided -- you can't lock on a brace
* ^From[ ]+owner-\/[^(_at_)]+@
{
:0 # extract stuff up to trailing @ into corrected MATCH
* MATCH ?? ^^[^(_at_)]+
{ LIST=$MATCH }
:0w:
| gzip -fc >>$LIST
}
For just the @ verification, having two overlapping conditions is
probably simpler:
:0w:
* ^From[ ]+owner-[^(_at_)]+@
* ^From[ ]+owner-\/[^(_at_)]+
| gzip -fc >>$MATCH
Hope this helps,
/* era */
--
.obBotBait: It shouldn't even matter whether <http://www.iki.fi/~era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>