On Mon, 27 Jan 1997 14:50:43 -0600, Philip Guenther
<guenther(_at_)gac(_dot_)edu>
wrote:
Timothy J Luoma <luomat(_at_)nerc(_dot_)com> writes:
I get email from a SPAM fighting group with the subject like this:
Subject: spam: waltercan(_at_)worldnet(_dot_)att(_dot_)net: Hello
I would like to take the second argument (the email address) and
REMOVE the ":" at the end of the email address and paste that to a
file of known spammers:
Yes, do the extraction in procmail. Just match the first string of
non-space characters after the colon, and that should do it, no?
Note that you want to get rid of the colon as well.
# You *must* use "[^ ]+" instead of "[^ ]*" as the latter will never
# match anything (probably).
:0
* ^From spam-list-owner(_at_)toby\(_dot_)han\(_dot_)de
* ^Subject: spam: *\/[^ ]+
* ^ Subject: spam: *\/[^ :]+
{
# Lock the file for the search and the insertion
LOCKFILE = spamfile.lock
:0
* ! ? grep -siw -e "$MATCH" $PROCDIR/killfile-by-from-line
Using fgrep might be more efficient, and should at least in principle
be recommended to avoid accidental matches. Your grep might have an -F
flag for doing exact (non-regexp) matching. [Some versions of fgrep
are actually very inefficient. The blurb in the man page about fgrep
being faster than grep is "standard" but allegedly not always true.]
{
# Be really efficient by doing the appending in procmail.
# Yes, this is obfuscated, but it should be fast.
# If you use LOGABSTRACT = all, this'll not show up in the log.
OLOGFILE = $LOGFILE
LOGFILE = $PROCDIR/killfile-by-from-line
LOG = "$MATCH
"
LOGFILE = $OLOGFILE
Pretty neat :-)
Have you timed this?
# Now exit (quickly)
HOST
}
# Unlock...
LOCKFILE
:0
|appnmail DuplicateSpam
}
/* era */
--
See <http://www.ling.helsinki.fi/~reriksso/> for mantra, disclaimer, etc.
* If you enjoy getting spam, I'd appreciate it if you'd register yourself
at the following URL: <http://www.ling.helsinki.fi/~reriksso/spam.html>