6.6.4 Using Sed for Lookups

The sed module is designed primarily for argument transformation. Nevertheless, it may also be used to define simple look-up databases. When used in a database clause of a dispatch rule, the module behaves as follows. The s-expression is applied to the key. If the result differs from the input key, the ‘positive-reply’ is returned. It the result is the same as the input key, ‘negative-reply’ is returned. If some error occurred, ‘onerror-reply’ is returned. The reply strings may be supplied as arguments to the database definition or to the module loading statement. The following variables are expanded within these strings:

map

The map name.

key

The key value.

xform

Transformed key value. This variable is not defined for ‘onerror-reply’.

Default replies are:

Reply Value
positive-reply OK ${xform}
negative-reply NOTFOUND
onerror-reply NOTFOUND