dbm(1M) TCP/IP 5.4R3.00 dbm(1M)
NAME
dbm - general dbm(3X) database management tool
SYNOPSIS
dbm [-AILRSU] [-d dbmfile] [-m mode] [-o outputfile] command
[args...]
DESCRIPTION
Dbm is used to manage dbm(3X) type databases. Its function is
controlled by the dbm command given on the command line, possibly
with additional arguments. Its typical usage is to load a dbm
database from an input file or to dump it to a readable format. It
may also be used to probe for selected keys or add/delete specific
key/value pairs. In addition, dbm provides parsing routines for an
extended textual format, suitable for building tables of various
kinds. The format is further described in the section about the
parse command below.
Options
-A Append mode, don't automatically clear the database on the
load and make operations.
-I Insert mode; will supply the DBM_INSERT flag to all dbmstore
operations. This means that if two entries with equal keys
are given, only the first will actually be entered to the
database and no warning will be given. The default, if
neither -I nor -R is supplied and two entries with equal keys
are given, is to enter the first into the database and print a
warning about the second.
-L Lowercase mode. Change all keys to lowercase before reading
from or writing to the database.
-R Replace mode; will supply the DBM_REPLACE flag to all
dbmstore operations. This means that if two entries with
equal keys are given, only the last will actually be entered
to the database and no warning messages are given.
-S Add a @@@ sentinel after the last entry has been written to
the database.
-U Uppercase mode. Turn all keys to uppercase before reading
from or writing to the database.
-d dbmfile
Perform all operations on the named database file. If no -d
option is given, the last argument after the command will be
used as the dbmfile.
-m mode
When creating new databases, use mode: an octal integer, such
as 0644. Not applicable if reloading an existing database.
Licensed material--property of copyright holder(s) 1
dbm(1M) TCP/IP 5.4R3.00 dbm(1M)
-o outputfile
Send all output from the dump and parse operations to the
named output file instead of stdout.
Commands
clear Creates an empty dbm database, either by clearing an old one
or by creating a new.
delete key [...]
Removes entries with the specified keys from the database.
dump Dumps the dbm database to stdout (or to outputfile, if the -o
option is used). The output will consist of one entry per
line with a tab between each key and value.
fetch key [...]
Fetch will search for the specified keys in the database and
print in dump format on the standard output both key and value
if found. Non-existing keys will be signaled by a [NOT_FOUND]
message.
load [file...]
Load the database with entries from the specified files. If
no files are given or if a file is specified as `-', the
database will be loaded from standard input. Each line of the
file should have a key and value separated by a tab.
(Incidentally, this is the same format as the dump command
will produce.) The database is first cleared unless the
append (-A) switch has been given.
make [file...]
Make combines the operations of parse and load (q.v.), by
storing each record after it has been parsed.
parse [file...]
This command will parse the contents of the specified files
(or stdin if no files are given or when a file is `-'),
according to the following syntax:
value key key ...
Whitespace delimit tokens and sharp signs (#) anywhere on a
line begins comments unless any of them are quoted by a
backslash (\) or put inside double quotes ("...") or angle
brackets (<...>). Lines beginning with whitespace are
considered to be continuations of the previous line. Note
that multiple keys for a given value are legal.
store key value [ key value ...]
Store one or more key/value pairs explicitly mentioned on the
command line.
EXAMPLES
dbm -d foo clear create the database foo
Licensed material--property of copyright holder(s) 2
dbm(1M) TCP/IP 5.4R3.00 dbm(1M)
cat infile | dbm load foo load it from the infile
dbm parse xfile | dbm -AI load foo add keys from the xfile...
(or, shorter) ...not already present...
dbm -I make xfile foo ...in the database
dbm fetch keya keyb foo fetch values for the keys
dbm -R store keyc valuec foo overwrite previous keyc value
dbm delete keyd valued delete keyd and valued
SEE ALSO
sendmail(1M), dbm(3X), ndbm(3C).
BUGS
Should probably remove the sentinel when opening the database for
write access (provided that the -S flag has been given).
Licensed material--property of copyright holder(s) 3