procmail
[Top] [All Lists]

Re: Returning a value to a recipe

2009-03-09 02:41:17
On 9/03/2009 17:11, Nigel Allen wrote:
On 9/03/2009 15:55, Nigel Allen wrote:

Hi

I am aware of how the basic whitelisting works from the docs on the web thus:

# whitelist
FGREP=/usr/bin/fgrep
FROM=`formail -x From:`
DEFAULT=/var/mail/cannon

:0E
* ? (echo "$FROM" | $FGREP -i -f $HOME/ok)
${DEFAULT}

However I need to do something a little different. I need to extract a customer header and look for it in a text file - so far so good. I then need to return a token from the file. For example, if my header contains 001 and the file contains:

001:fred
002:jim

I need to return the value "fred" back to my recipe.


Further to this, I also need to know if there was a match or not.

This is my first attempt at this - anyone care to comment?


  :0E
STAFF = `grep $FLDR /etc/staff_codes.txt| awk -F":" ' {print $2} END {if (NR == 0) print "Null" } '`
  * ! STAFF ?? Null
  {
     "$STAFF/"
  }



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail