procmail
[Top] [All Lists]

Re: Assist with filtering by external files

2004-03-19 05:20:25
On Thu, Mar 18, 2004 at 10:31:37PM -0500, Daniel wrote:
[Dallman Ross wrote:]

On Tue, Mar 16, 2004 at 11:59:13PM -0500, Daniel wrote:

* ? grep -i ^"${MYSUBJECT}"$  $LIST/subject.txt

I suggest you use fgrep specifically to avoid
regexes from the Subject string.  I see no point in
your ^ and $ around the grep string; it would be
a tautology, it seems to me.  Perhaps you envision
the start-to-finish of the line in the $LIST/subject.txt
file, in which case you should use the -x flag to
grep.

  I did think in those terms where the each subject had to
  match the whole list from start to finish. Only because I
  had matches with word in the middle of the line. The -x
  flag (read man) does seems like it will do the same thing.

Yes.  I also think I misread something when I wrote that
"see no point stuff"; sorry about that.

  So is there any difference in using "${MYSUBJECT}" vs.
  "$MYSUBJECT"?

No.

And since it's grep and not procmail here, you could even
just test it in a few seconds on the command line in your
shell.

 bash-2.05b$ FOO=foo
 bash-2.05b$ echo "foo me once, shame on you" | grep "${FOO}"
 foo me once, shame on you
 bash-2.05b$ echo "foo me once, shame on you" | grep "$FOO"  
 foo me once, shame on you


  Basically I could hard code the "words" to match instead
  of using external files. I tried doing that and I saw a
  LINEBUF within the log file. So I would have to break the
  recipe in two or increase the size of LINEBUF. One thing
  thought, how much overhead is using grep and formail vs.
  hard coding? Is there a way to find out? Would I run "TOP"
  to compare?

I don't know about "top"; maybe someone else will answer that.
You could use "time" for starters, on a lump of a few hundred
messages run through your test harness (aka sandbox).  You
do have one, right?  :-)  (See Sean Straw's posts for a link
in his .sig to instructions on how he creates one.)

But basically, if your servers are well-exercized you would
do well to internalize into procmail as much of the operation
as it is conventient to do, yes.

Frankly, I'm not persuaded by the entire approach you're after,
though.  I find very little value in grepping entire Subject
lines.

-- 
dman

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail