procmail
[Top] [All Lists]

CLEANTO anyone?

2004-05-29 20:40:49
Before I reinvent a wheel, I thought I'd ask if anyone has a pointer
to a procmail recipe (using some clever MATCH magic perhaps or
maybe with a bit of additional sed) that would extract all the
address portions, minus comments, from a set of commented addresses?

I'd expect to do something like:

:0
* To:[  ]*\/[^  ].*
{
        RAWTO = $MATCH
}

then somehow render RAWTO into CLEANTO.  Then do the same for Cc:
and any other fields I cared about.

This exercise gets non-trivial if you want to exclude comments with
addresses in them, so if I could steal someone else's ideas, I'd have
more time to work on non-wheel-inventing things. :)  Surely this is
a common need, but I couldn't find anything on the procmail archive.
I think I've reached the point where further searching would take
longer than just diving in and writing it myself.

My current motivation is to just count the real addresses, so
something like:

:0
* 1^1 RAWTO ?? regex-that-ignores-comments

would work.  Alternatively, something like:

:0
*  1^1 RAWTO ?? regex-that-counts-@
* -1^1 RAWTO ?? regex-that-counts-(_at_)-only-within-comments

would also do the trick.  Counting, I'm sure, is much easier than
a full cleaning job, but if possible, it might be useful someday
to have the clean address set.

I'm certainly not looking for someone to write this for me; I'm just
looking for a pointer to someone's example page that has already done
it.

TIA,

Jim

_______________________________________________
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>