procmail
[Top] [All Lists]

Re: Renaming file attachments (read: metacharacters are evil)

2002-01-05 03:26:29
On Sat, Jan 05, 2002 at 04:07:36AM -0600, subtlerage wrote:
I've been trying to come up with a recipe that would parse the filename of
any file attachment, convert any white space to underscores, and simply
delete any metacharacters.

In perl, this would be simply:

$_ = shift;
tr/ \t/__/s; # replace " " and "\t" with "_"
tr/a-zA-Z0-9_\-//cd; # delete any non-alphanumeric characters
print;

I'm not sure if procmail has the tr// (aka y//) function...
_______________________________________________
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>