The manner in which the key and its value are visually displayed in flat, sequential, text files and certain network services, might not be directly suitable for use with database maps. A text-type file—for example, /etc/hosts—might display the key on the right and the value on the left:      here.our.domain

For such circumstances the -v switch can be used with the K command to specify the column or item that will be returned as the value when a key is matched. For example:

Kaddr text -k1 -v0 /etc/hosts

For nisplus, netinfo, user, and other such database maps, the -v switch specifies the name (text) of the value’s column.

This -v switch specifies which column is the value to return. If it is omitted, it defaults to 0 for the text type (which is indexed beginning with 0) to the last named column for the nisplus type, and to the string "members" for the netinfo type. Note that the -v switch has a different meaning for the ph database-map type. See also -k (-k) for the value’s column and -z (-z) for the column delimiter.

Get Sendmail, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.