I'm using the following (classic) procmail recipe to catch mailing list e-mails and file them into a folder by list name:
:0
* ^((List-Id|X-(Mailing-)?List):(.*[<]\/[^>]*))
{
LISTID=$MATCH
:0
* LISTID ?? ^\/[^@\.]*
Lists/$MATCH/
}
The problem is: if a list name changes from all lowercase to Firstlettercap, I end up with two folders, one for 'listname' and another for 'Listname'.
I'd like to lowercase the $MATCH variable before using it in the final delivery rule, but I'm not able to find a reference to a lc() function, or a regex/replacement that can be used to do this.
One comment below suggested this:
:0
* ^((List-Id|X-(Mailing-)?List):(.*[<]\/[^>]*))
{
LISTID=`echo "$MATCH" | tr A-Z a-z`
:0
* LISTID ?? ^\/[^@\.]*
.Lists.$MATCH/
}
Which also doesn't appear to do what I'm after. Though, looking at it now, clearly the transliteration is only happening on the first occurrence of $MATCH and my guess is that it's not changing it at all for the use in the folder assignment line.
UPDATE #1: If I try to use LISTID in the folder assignment line, I get something like 'Bricolage.project.29601.lighthouseapp' instead of just 'Bricolage' or -- what I'm after -- just 'bricolage'.