procmail
[Top] [All Lists]

Re: character substitution in $VARIABLE

2003-11-07 09:32:21
On Fri, Nov 07, 2003 at 09:08:14AM -0600, David W. Tamkin wrote:
Louis-David Mitterrand asked:

I'd like to convert these dots to dashes (eg:
users-lists-freeswan-org) preferably without using sed.

You could use a recursive SWITCHRC within procmail and not call any
outside programs at all, but it's a pain to write, and it's probably no
more efficient than simply running tr (well, a shell and tr) as Ian
suggested.

As you've already got to do an `echo | something` (implying a shell) you
might want to find out whether your shell itself can do the substitution.
If your $SHELL is one of bash2, ksh93, or zsh4:

        FOLDER=`echo "${FOLDER//./-}";`

The trailing semicolon is to force procmail to spawn a shell, which has
the side-effect of preventing procmail from doing the substitution itself
(and producing a "Bad substitution" error).


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