* Don Hammond (procmail1(_at_)tradersdata(_dot_)com) wrote:
:0
* ^Subject:.*\[Yahoo! Clubs: \/[^]]+]$
* MATCH ?? ^^\/[^]]+
{
xFILE=`echo "$MATCH" |tr -s '\t ' '_'`
:0:
$xFILE
}
Nice and (relatively) simple, i like that. Gotta test it today :)
The translation of space chars to underscores could undoubtedly be done
with a resursive call to an rcfile, but this seems reasonable. ;-)
Caveats (that I can think of):
1. Your tr must understand \t for tab (unless you don't think it's
necessary and it's removed). GNU tr does - I don't know if others do.
I use Linux Mandrake, that's no problem :)
2. This won't match if there is whitespace between the [Yahoo! ...] crap
and the end of the Subject: line. It could be fixed, if necessary, by
inserting [ ]* (space,tab char class) just before the $ anchor.
I don't think that's possible, that gets inserted automagically, by a script
i suppose, so i don't think it'll change
3. If there are any ] chars before the final closing one the \/ operator
will truncate $MATCH at that point, delivering to a filename at least
slightly different than you might expect.
I don't think that's possible either for the same reason
4. If there are any / chars within the [Yahoo! ...] crap a matching
directory hierarchy would be expected. I don't think procmail creates
directories, so you'd probably get a write error and presumably
failsafe delivery to $DEFAULT. If that's a risk, you would either want
to add / to the tr command to translate it to _, or use a second tr pipe
(same command line) to translate / to something else of your choosing.
You might want to do the same thing with some other chars like \ also,
just on general principles.
I would deliver to Maildirs, so it would create directories, but not in the
same way, but i think that's not possible for the above reasons
5. You might need/want to prepend a path to $xFILE.
Of course, i put all my lists in ~/Maildir/lists/listname
--
/"\
Don Hammond \ / ASCII Ribbon Campaign
Raleigh, NC US X Against HTML Mail,
/ \ and News Too
Nice campaign, added it to my .signature too, let it grow :)
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
---------------------------------------
Jaime Herazo Barrios /"\
jherazo at geocities dot com \ / ASCII Ribbon Campaign
ICQ number: 14721935 X Against HTML Mail,
Yahoo! id: jherazo_1999 / \ and News Too
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail