thompson(_at_)cu48(_dot_)crl(_dot_)aecl(_dot_)ca (Martin A. Thompson) writes:
I would like to sort a huge amount of incoming mail messages according to
country
of origin. I intend to have the 'senders' include a line similar to
Country: Canada
or
Country: Zambia
How would I sort on this field in the BODY of a message and save to
appropriately named country folders if I do not know what countries
to expect?
ie. the above should go into
IN.Canada
and
IN.Zambia
Any ideas or tricks???
:0:
* B ?? ^Country: *\/[a-z]+
IN.$MATCH
Notes:
o procmail is case insensitive by default, so we only need to
match [a-z].
o If you want to match more than letters, you almost certainly
should _not_ match slash to avoid directory problems. It
shouldn't be a security hole, but it could be ugly.
o The "B ??" bit makes procmail match against the body instead
of the header.
o The magic \/ regexp token and $MATCH were introduced in procmail
version 3.10 To do this with an earlier version of procmail would
require an outside process and would be quite a bit slower and
less efficient, though possible. Upgrading procmail would be the
prefered solution of course.
Philip Guenther