DB(1) NetBSD General Commands Manual DB(1)
db -- manipulate db(3)'s btree(3) and hash(3) databases
db [-DKiNqV] [-E endian] [-f infile] [-O outsep] [-S visitem] [-T visspec] [-U unvisitem] [-X extravis] type dbfile [key [...]] db -d [-iNq] [-E endian] [-f infile] [-T visspec] [-U unvisitem] type dbfile [key [...]] db -w [-CDiNqR] [-E endian] [-F insep] [-f infile] [-m mode] [-P pagesize] [-T visspec] [-U unvisitem] type dbfile [key value [...]]
db allows manipulation of btree(3) and hash(3) (db(3)) databases. db has three modes of operation to perform upon dbfile: read Displays the given keys, and keys described in infile. If no keys and no infile is specified, the entire database is displayed. This is the default mode of operation. delete Enabled with -d. Deletes the given keys, and keys described in infile. write Enabled with -w. Writes the given keys and values, and keys and values described in infile (in the latter case, entries are separated by insep). There are two mandatory arguments: type is the database type; either `btree' or `hash', and dbfile is the database file to manipulate. Options valid for all modes are: -E endian Set the endianness of the database. endian may be one of: B Big endian H Host endian L Little endian Defaults to `H' (host endian). -f infile Contains a list of keys (for read and delete), or insep separated keys and values (for write) to be used as arguments to the given mode. If infile is `-', stdin is used. -i Keys are converted to lower case before manipulation. -N Include the NUL byte at the end of the key or value. By convention, each key and value in the underlying database is terminated with a NUL byte, although it is possible to have keys or values that are not so termi- nated. Without the -N option, db adds a NUL terminator to any keys and values specified on the command line or in the input file, before searching or modifying the underlying database, and removes the last byte (which is usually a NUL terminator) before printing any keys and values retrieved from the underlying database. With the -N option, db does not add or remove a termi- nating byte. The -S, -T, and -U options may be useful to encode the NUL terminator in a readable form. -q Quiet operation. In read mode, missing keys are not considered to be an error. In delete (-d) and write (-w) modes, the result of various operations is sup- pressed. -T visspec Control how the items specified by the -S option are encoded and -U option are decoded. The visspec option- argument is a string specifying strsvisx(3) flags. The string consists of one or more characters: b VIS_NOSLASH c VIS_CSTYLE. Overrides h and o. h VIS_HTTPSTYLE. Overrides c and o. o VIS_OCTAL. Overrides c and h. s VIS_SAFE t VIS_TAB w VIS_WHITE -U only supports -T h. See vis(1)'s corresponding options for the meaning of these characters, and strsvisx(3) for more detail on the flags. -U unvisitem Specify items to strunvisx(3) decode. The unvisitem option-argument is a character specifying if the key (k), the value (v) or both (b) should be decoded. Read mode specific options are: -D Display duplicate entries in btree databases. -K Display key. -O outsep Field separator string between key and value. Defaults to a single tab (`\t'). -S visitem Specify items to strsvisx(3) encode. The visitem option-argument is a character specifying if the key (k), the value (v) or both (b) should be encoded. -V Display value. -X extravis When encoding items with -S option also encode charac- ters in extravis, per strsvisx(3). (If neither of -K or -V is given, both options are enabled.) Write mode specific options are: -C Create new database, and truncate existing databases. -D Allow duplicate entries in btree databases. (Requires -R to be useful.) -F insep Input field separator string between key and value used when parsing infile. Defaults to a single space (` '). -m mode Octal mode of created database. Defaults to `0644'. -P pagesize Set the page size of the table to pagesize bytes. If set to `0', a database-specific default is determined, based on the block-size of the underlying file-system. Defaults to `4096'. -R Overwrite existing entries. If not specified, writing to an existing entry raises an error.
vis(1), btree(3), db(3), hash(3), strsvisx(3), strunvisx(3)
The db command appeared in NetBSD 2.0.
Luke Mewburn <lukem@NetBSD.org>. NetBSD 9.0 February 17, 2012 NetBSD 9.0
You can also request any man page by name and (optionally) by section: