Re: [Exim] Berkeley DB lookpus on exim

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Philip Hazel
Data:  
Para: John Ward
CC: exim-users
Asunto: Re: [Exim] Berkeley DB lookpus on exim
On Tue, 10 Jul 2001, John Ward wrote:

> After being given some good tips on how to check thngs out, I've managed to
> get both the utilities to compile with DB3 and i get no error messages.
>
> I have the following question tho, If I have an entry in the table which has
> my ip address as the key and then a timestamp followed by the ip address as
> the data, how would i get the exim executable to read the second data field ?


You mean you have something like:

key = 10.9.8.7
data = 11-Jul-01 10.11.12.13

as one record? If I have understood this right, that means that when you
look up the key "10.9.8.7" you will get back the data "11-Jul-01 10.11.12.13"
as one string. You now want to discard the timestamp?

You can use various string manipulation facilities to do this. If the
timestamp is always of fixed length, it is simple. For the example
above, where the length is 10 (including the space), you could use

${lookup{10.9.8.7}dbm{/the/file}{${substr_10:$value}}fail}

If the timestamp is not of fixed length, you could use a regular
expression to match it. Or you could use the ${extract} operation if
there is a unique separator between the fields.

-- 
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.