procmail
[Top] [All Lists]

Re: Logging and file grepping

2004-04-15 02:01:27
On Wed, Apr 14, 2004 at 11:41:56PM -0400, Daniel wrote:

[Dallman Ross wrote:]

:0 B:  # <---- colon for lockfile!
     * your body conditions

I thought setting the lockfile was only for forwarding emails?

What caused you to think such a thing?  Not only is it not true, it
is bass-ackwards.  Lockfiles are for delivering to, or processes
that terminate in, files on a local machine where a race condition
could otherwise garble (corrupt) data by overwriting it with a
competing process.

procmail: Match on "filename="\/.*[^"]+"
procmail: Executing
"egrep,-wis,-e,()test3\.txt,/usr/local/etc/spamlist/netskyd_attach"
procmail: Non-zero exitcode (1) from "egrep"
procmail: No match on "egrep -wis -e ()test3\.txt

Okay, so it didn't match.  Was that in your netskyd_attach file?

I recommend using fgrep and dumping
regex idea in that list, though.
In that case, don't quote $MATCH:

  yours * ? fgrep -wis -e "$MATCH" $LIST/netsky_attach
    mine *? fgrep -I $MATCH $LIST/netsky_attach

Why did you leave the quotes off?  You want the quotes around $MATCH.
If spacing is different, you won't get a match.

Without at least a -w switch or an -x to fgrep, you will get all
sorts of bad matches (false positives).  "file" could match
"nondefilement"; and so on.


With the exception of the w, s, and e option the above is pretty much what I
have now. No? I wouldn't say the "-s" is needed only because not to many (if
any) filenames have spaces. The reason I wanted the regexes is so that I

The -s has nothing to do with spaces.  However, depending on what grep
you have compiled, you might indeed want to leave it off:

       -s, --no-messages
              Suppress   error   messages  about  nonexistent  or
              unreadable files.   Portability  note:  unlike  GNU
              grep,  traditional grep did not conform to POSIX.2,
              because traditional grep lacked a -q option and its
              -s option behaved like GNU grep's -q option.  Shell
              scripts intended to be portable to traditional grep
              should  avoid  both  -q  and -s and should redirect
              output to /dev/null instead.

I have no -I switch in my grep, so I don't have any idea what version
you are running.


don't have to have
test1.txt
test2.txt
And so on. So it thought have a regex of test.*\.txt would cover it. I could
be wrong, and it may require more resources. I don't know which way would be
better, comparing resources and speed.

If you are using fgrep, you do not use regexs at all; only fixed strings.
So the quote of the dot in your sentence above will cause the match to
fail.

About the "LOG", I only want it to make the entry when it matches the
"netsky_attach" and not the "netsky_subject". Is there a way to do this.

Of course.  Put the log call in a nested brace recipe set below what succeded
that you want to log.

-- 
dman

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

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