BTREEOP(1)

NAME
btreeop - btree database maintenance tool

SYNOPSIS
btreeop [-A] [-C] [-D[keyno] key] [-K[keyno] key] [-L[2]] [-k prefix] [dbname]

DESCRIPTION
Btreeop execute simple operations for btree(3) database. Btreeop can create database, write record, read record (sequential or indexed) and delete record from it. Duplicate entries are allowed. Multi-key is available but only primary key can use index of btree(3).

OPTIONS
A capital letter means a command. If no command specified then it assume sequential read operation.

-A  append records. If database doesn't exist, btreeop creates it.

-C  create database and write records to it.

-D[keyno] key
    delete records by the key. By default, keyno is 0 (primary key).

-K[keyno] key
    search records by the key. By default, keyno is 0 (primary key).

-L[2]
    list all primary keys. If '2' is specified, list all the key and data pairs.

-k prefix
    scan records which have the prefix as a primary key. This option is valid only with sequential read operation (-L command or non command).

dbname
    database name. default is 'btree'.

DATA FORMAT
To creat (or append) database, btreeop read data from stdin. The format of the data is the following. Primary-key Secondary-key-1 Secondary-key-2 Data (keyno = 0) (keyno = 1) (keyno = 2) -------------------------------------------------------------- main 246 main.c main (){\n func 120 library.c func(a1, a2)\n . . .

1.  All key and data are separated by blank('\t' or ' ').

2.  Key cannot include blank.

3.  Data can include blank.

4.  Null data not allowed.

5.  Additionally, META record is available. META record has a key that start with a blank. You can read this record only by indexed read operation (-K option). Usage is unlimited by btreeop.

EXAMPLES
Create database. % btreeop -C key1 data1 key2 data2 key3 data3 ^D % Append records. % btreeop -A __.VERSION 2 key2 data2-2 ^D % Sequential read. % btreeop key1 data1 key2 data2-2 key2 data2 key3 data3 % Indexed read. % btreeop -K key2 key2 data2-2 key2 data2 % btreeop -K ' __.VERSION' __.VERSION 2 % List primary keys. % btreeop -L key1 key2 key3 % Delete record. % btreeop -D ' __.VERSION' % btreeop -K ' __.VERSION' %

FILES
btree
    default database name.

DIAGNOSTICS
Btreeop exits with a non 0 value if an error occurred, 0 otherwise.

SEE ALSO
btree(3)

AUTHOR
Shigio Yamaguchi (shigio@wafu.netgate.net)

HISTORY
The btreeop command appeared in FreeBSD 2.2.2.