Home | History | Annotate | Line # | Download | only in db
db.1 revision 1.4
 $NetBSD: db.1,v 1.4 2002/12/29 11:17:04 seb Exp $

Copyright (c) 2002 The NetBSD Foundation, Inc.
All rights reserved.

This code is derived from software contributed to The NetBSD Foundation
by Luke Mewburn of Wasabi Systems.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by the NetBSD
Foundation, Inc. and its contributors.
4. Neither the name of The NetBSD Foundation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

.Dd December 29, 2002 .Dt DB 1 .Os . .Sh NAME .Nm db .Nd manipulate .Xr db 3 's .Xr btree 3 and .Xr hash 3 databases . .Sh SYNOPSIS .Nm "" .Op Fl KV .Op Fl Niq k -words .Op Fl E Ar endian .Ek k -words .Op Fl f Ar infile .Ek .Ar type .Ar database k -words .Op Ar key Op Ar ... .Ek . .Nm "" .Fl d .Op Fl Niq k -words .Op Fl E Ar endian .Ek k -words .Op Fl f Ar infile .Ek .Ar type .Ar database k -words .Op Ar key Op Ar ... .Ek . .Nm "" .Fl w .Op Fl Niq k -words .Op Fl E Ar endian .Ek k -words .Op Fl f Ar infile .Ek .Op Fl CDR k -words .Op Fl F Ar fieldsep .Ek k -words .Op Fl m Ar mode .Ek .Ar type .Ar database k -words .Op Ar key Ar value Op Ar ... .Ek . .Sh DESCRIPTION .Nm allows manipulation of .Xr btree 3 and .Xr hash 3

q Xr db 3 databases.

p .Nm has three modes of operation: l -tag -width "delete" -offset indent t read Displays the given .Ar key Ns s , and keys described in .Ar infile . If no keys and no .Ar infile is specified, the entire database is displayed. This is the default mode of operation. t delete Enabled with .Fl d . Deletes the given .Ar key Ns s , and keys described in .Ar infile . t write Enabled with .Fl w . Writes the given .Ar key Ns s and .Ar value Ns s , and keys and values described in .Ar infile (in the latter case, entries are separated by .Ar fieldsep ) . .El

p There are two mandatory arguments: .Ar type is the database type; either .Sq Sy btree or .Sq Sy hash , and .Ar database is the database file to manipulate.

p Options valid for all modes are: l -tag -width Fl -offset indent . t Fl N Do not include the NUL byte at the end of the key. . t Fl i Keys are converted to lower case before manipulation. . t Fl q Quiet operation. In read mode, missing keys are not considered to be an error. In delete

q Fl d and write

q Fl w modes, the result of various operations is suppressed. . t Fl E Ar endian Set the endianness of the database. .Ar endian may be one of: l -tag -width 1n -offset indent -compact t Sy B Big endian t Sy H Host endian t Sy L Little endian .El Defaults to .Sq H (host endian). . t Fl f Ar infile Contains a list of keys (for read and delete), or .Ar fieldsep separated keys and values (for write) to be used as arguments to the given mode. If .Ar infile is .Sq Sy - , .Dv stdin is used. . .El .

p Read mode specific options are: l -tag -width Fl -offset indent t Fl K Display key. t Fl V Display value. t Fl s Ar string Field separator string between key and value. Defaults to a single tab

q Sq \et . . .El

p d -ragged -offset indent (If neither of .Fl K or .Fl V is given, both options are enabled.) .Ed .

p Write mode specific options are: l -tag -width Fl -offset indent . t Fl C Create new database, and truncate existing databases. . t Fl D Allow duplicate entries. (Requires .Fl R to be useful.) . t Fl R Overwrite existing entries. If not specified, writing to an existing entry raises an error. . t Fl F Ar fieldsep Field separator between key and value used when parsing .Ar infile . Defaults to a single space

q Sq . . t Fl m Ar mode Octal mode of created database. Defaults to .Sq 0644 . . .El . .Sh SEE ALSO .Xr btree 3 , .Xr db 3 , .Xr hash 3 , .Xr makemap 8 . .Sh HISTORY The .Nm command appeared in .Nx 1.7 . . .Sh AUTHORS .An Luke Mewburn Aq lukem (at] netbsd.org .