Richard De A'Morelli wrote:
I know there must a simple solution for this that
can be integrated into a .procmailrc script, but
whatever it is eludes me and I have wasted the last
12 hours hacking and scouring the Web to no avail.
We have a mail message containing the header
Subject: Much Big News #1234xxx
In a .procmailrc script, we have...
TOPIC = `formail -x Subject|sed 's/[ ][^ ]*$//'`
$TOPIC now equals "Much Big News" and we have stripped
off the "#1234xxx"
But how do you get that last word (which happens to be
a password) into a variable using sed??? What I need
is to be able to do something like
KEYWORD = `formail -x Subject|sed '???'`
...so that $KEYWORD will equal "#1234xxx" or better yet,
$KEYWORD will equal "1234xxx" (without the "#" trigger)
Inefficient, but better than wasting 12 hours:
KEYWORD = `formail -x Subject | sed 's/.*#//'`
(This assumes that what you want is the stuff after the first '#'
only. If I can't make that assumption, then your problem hasn't
been stated clearly enough.)
(There may be a better way, but I don't worry about optimizing these
things once they work, since I'm only dealing with low volume.)
Cheers,
Stan.