procmail
[Top] [All Lists]

Re: Rejecting multiple names/subjects at once?

1996-07-08 09:06:38
On Mon, 8 Jul 1996 10:27:19 -0500 (CDT), dattier(_at_)wwa(_dot_)com 
(David W. Tamkin) said:

Mike followed up:

| The problem I'm trying to solve is how to have one regexp per
| line, with an unlimited number of lines in the file.

That's precisely what fgrep's and egrep's -f option is for: reading a file to
get the text (for fgrep) or regexps (for egrep) that the program will look
for in the input.  So that's why Alan suggested using egrep -f in the first
place.

My post was because "egrep -f" gives an error "regular expression too
long".  The data file I included was for the convenience of anyone who
wished to reproduce the problem for themselves.  My original post is
appended.

So far the most common suggestion has been to use "fgrep -f", which
doesn't allow regexp's in the file.  It would be straight-forward to
write a perl script to step through the file of regexps, but I'd
prefer "egrep -f" since it appears it should do exactly what I want.

Mike

------- start of forwarded message (RFC 934 encapsulation) -------
Received: Fri, 5 Jul 96 16:45:20 EDT by prufrock.sogs.stsci.edu (4.1)
In-Reply-To: 
<199606101511(_dot_)IAA15603(_at_)anywhere(_dot_)engr(_dot_)sgi(_dot_)com>
References: 
<199606100212(_dot_)VAA18804(_at_)clm(_dot_)aiss(_dot_)uiuc(_dot_)edu>
        
<199606101511(_dot_)IAA15603(_at_)anywhere(_dot_)engr(_dot_)sgi(_dot_)com>
From: Mike Rose <mrose(_at_)stsci(_dot_)edu>
To: "Alan K. Stebbens" <stebbens(_at_)sgi(_dot_)com>
Cc: procmail(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE (procmail list)
Subject: Re: Rejecting multiple names/subjects at once? 
Date: Fri, 5 Jul 96 16:45:20 EDT

On Mon, 10 Jun 1996 08:11:56 -0700, "Alan Stebbens 
<stebbens(_at_)anywhere(_dot_)engr(_dot_)sgi(_dot_)com>" 
<stebbens(_at_)anywhere(_dot_)engr(_dot_)sgi(_dot_)com> said:

   # This recipe filters FROM through the badaddrs file, if egrep succeeds,
   # then we don't want this mail, and we'll bounce it
   :0E
   * ? echo "$FROM" | egrep -f $BADADDRS
   { BOUNCE=1 }

I usually get the error "egrep: regular expression too long" when I
run the above command.  This is on SunOS 4.1.  Here's how to reproduce
it:

- --- file junkfile.data: ---
u1(_at_)alpha(_dot_)beta(_dot_)gamma
u2(_at_)delta(_dot_)epsilon
u3(_at_)foo(_dot_)bar(_dot_)baz
u4(_at_)plugh(_dot_)plover
u5(_at_)xyzzy(_dot_)com
u6(_at_)frobozz(_dot_)magic-wells(_dot_)com
mrose.stsci.edu
- --- end file ---

The command is:

   echo "mrose(_at_)stsci(_dot_)edu" |egrep -f junkfile.data

If I change the last line of the file from "mrose.stsci.edu" to
"mrose(_at_)stsci(_dot_)edu", then the command works correctly.  That's not a
solution, just a boundary.

Does anyone have any suggestions how to make this work?  It would be
very convenient to be able to put a bunch of regexp's in a file and
match for junk mail (and other things) against each line in the file.

Thanks,

Mike Rose
------- end -------