On Fri, Dec 07, 2001 at 07:42:06PM +0000, Martin McCarthy wrote:
Is it possible to use a backquote expansion as part of the action
itself? What about something like:
Certainly. That should work fine (ignoring the fact that I have no idea
what '-E' does to sed :-)).
As always, something implementation-specific. In FreeBSD, sed will by
default assume you're using basic regular expressions, and so will
behave exactly like sed in Solaris. The -E option tells it to use
extended (modern) regexps instead of basic. I don't know how GNU sed
behaves; I don't use it.
I prefer the more verbose version because I'm *really* bad and
remembering what my code was supposed to do and find it more readable
like that. But whatever works for you is, of course, the right thing.
I'd put it in a variable if I wanted to do additional sanity checking
on the mailbox format. If I was implementing this on a larger scale and
didn't want to have to risk saving things to weird places if people
changed their headers, I be more careful. Something like:
:0
*
^List-Unsubscribe:.*leave-\/isp-(_dot_)*(_at_)(_dot_)*isp-lists(_dot_)com
{
NAME=`echo "$MATCH" | sed 's/-[^-][^-]*(_at_)(_dot_)*$//'`
:0:
* ! NAME ?? @
$NAME
}
so if it can't figure out a specific folder, it'll save it in DEFAULT
rather than creating new folders named for what it does fine. A rule
like this could be generalized to include just about any lists using
Lyris. Hmm....
Note the OS-independent sed script. ;-)
--
Paul Chvostek
<paul(_at_)it(_dot_)ca>
Operations / Development / Abuse / Whatever vox: +1 416 598-0000
IT Canada http://www.it.ca/
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail