On Mon, Jan 26, 2004 at 01:05:08PM +0100, Philipp Weis wrote:
> On 26 Jan 2004, Matt Price <[EMAIL PROTECTED]> wrote:
> > So I asusme the script is running, but it's not receiving the data it
> > needs, or at least not understanding it.  
> > 
> 
> Procmail sends the message via STDIN, so you would have to read it from
> there. As you have to read the message more than once for the different
> formail calls, it would probably be best to save the message in a
> temporary file and read it from there afterwards. So put a 
> 
>   msg=`tempfile`; cat > "$msg"
> 
> on top of your script and replace all $@'s with $msg. Don't forget to
> delete $msg when your done.
> 

Thanks for this, that fixed the initial probem.  
A follow up:  I'd like to strip the '@' sign from user addresses as a
minimal precaution against spam-oriented webcrawlers.  so I have a
variable 
FROM=`formail -x From: <$msg`

which has the value:

echo $FROM
Matt Price <[EMAIL PROTECTED]>

Now, if this information were stored in a file, it would be simple to
manipulate with regex's:

sed 's/@/ -at- /' addressfile

But I don't see an obvious way to get sed or awwk to take variable values
as input.  I can do the following:

FROM=`formail -x"From:" < "$msg"` ; 
echo $FROM > tempfrom 
FROM=$(sed 's/@/ -at- /' tempfrom) 

but this strikes me as awkward.  Is there a better way?  

thx,
matt


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to