Script question

Polytropon freebsd at
Sat Jun 13 00:36:42 UTC 2015

On Fri, 12 Jun 2015 18:53:25 -0500, Lt. Commander wrote:
> Am running fbsd-9.3 and sendmail-8.15 plus spamassassin.
> I would like to be able to scan the daily maillog with a script
> at midnight to extract a list by selecting spam recognized and
> contained using the constant "score=(greater than x) and from
> that a list of just the IPs which will be placed in a spam file
> as part of a spam system here. Am tired of some getting past
> spamass even though it exceeds a reasonable tag level.

What you're describing here sounds like the typical functionality
of a spam filter. None of the present solutions fits your needs?

> I do know how to extract just the IP from a line in the log,
> but not sure what the syntax should be to first ID the "score=<x"
> in a simple sh shell script.

If you can provide an anonymized example from such a log line,
you might get a direct suggestion. At this point, if you have
to use sh tools (sh, sed, awk, cut, grep et al.), you can
probably do this the easiest using awk, with a pattern that
matches the spam score criteria, and then trim the line down
to the information (here: IP) you need. Surely you can also
do this with a "grep | sed | cut pipeline", but awk can
probably do this alone. Anyway, also consider perl which is
"the typical tool" for the task of "log distillation". :-)

> I hope this has been presented clear enough to gather some help on this task.

It is. An example of your input and desired output would
have been nice. :-)

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list