makedbm(8yp)
NAME
makedbm − make a Yellow Pages dbm file
SYNTAX
makedbm [ −i yp_input_file ] [ −o yp_output_name ] [ −d yp_domain_name ] [ −m yp_master_name ] infile outfile
makedbm [ −u dbmfilename ]
DESCRIPTION
The makedbm command takes the file specified by the argument infile and converts it to a pair of files in dbm(3x) format, namely outfile.pag and outfile.dir. Each line of the input file is converted to a single dbm record. All characters up to the first tab or space form the key, and the rest of the line is defined as the key’s associated data. If a line ends with a backslash character (), the data for that record is continued onto the next line. It is left for the clients of the Yellow Pages to interpret the number character (#); makedbm does not treat it as a comment character. The infile parameter can be −, in which case makedbm reads the standard input.
The makedbm command is meant to be used in generating dbm files for the Yellow Pages service. The makedbm command generates a special entry with the key yp_last_modified, which is the date of infile.
OPTIONS
−i Create a special entry with the key yp_input_file.
−o Create a special entry with the key yp_output_name.
−d Create a special entry with the key yp_domain_name.
−m Create a special entry with the key yp_master_name. If no master host name is specified, yp_master_name will be set to the local host name.
−u Undo a dbm file. That is, print out a dbm file one entry per line, with a single space separating keys from values.
EXAMPLE
The following example shows how a combination of commands can be used to make the Yellow Pages dbm files passwd.byname.pag and passwd.byname.dir from the /etc/passwd file. The percent sign (%) signifies the system prompt.
% awk ’BEGIN { FS = ":"; OFS = ""; }
{ print $1, $0 }’ /etc/passwd > ptmp
% makedbm ptmp passwd.byname
% rm ptmp
The awk command creates the file ptmp which is in a form usable by makedbm. The makedbm command uses the ptmp file to create the Yellow Pages dbm files passwd.byname.dir and passwd.byname.pag. The rm command removes the ptmp file.