.Dd Feb 7, 2021 .Dt SDB 1 .Os .Sh NAME .Nm sdb .Nd simple key-value database baked by base64, json and arrays .Sh SYNOPSIS .Nm sdb .Op Fl 0dehjJv .Ar -|db .Ar [-|=|==] .Ar [.file|expr ..] .Sh DESCRIPTION SDB is a simple disk and memory string-based key-value database. It is based on CDB and uses .Bl -tag -width Fl .It Fl d Decode stdin as base64 and prints to result to stdout .It Fl D Find differences between two databases .It Fl C Create the C and H files for a perfect hash implementation of the contents of the given Sdb .It Fl G Create the gperf file used by -C .It Fl e Encode stdin in base64 and prints to stdout .It Fl h Show help message .It Fl j Indent JSON from stdin if no more arguments, otherwise dump database as JSON. .It Fl J Enable journaling .It Fl h Show help message .It Fl v Show version .El .Sh EXAMPLES Some useful ways to run it: .Pp $ sdb - ; in memory database .Pp $ sdb test.db = < test.txt ; create database from text file .Pp $ sdb test.db == a.txt b.txt ; create database from text files in a single command .Pp $ sdb test.db ; dump contents of database .Pp $ sdb test.db a=b a ; inline queries .Pp Append those quoted commands to 'sdb -' to test these sdb_query expressions: .Pp a=hello b=world a b # hello world .Pp a=1 +a -a # 2 1 ; key inc/dec .Pp a={"a":122} a:a=O a # {"a":0} ; json set .Pp a={"foo":122} +a:foo # 123 ; json increment .Pp []a=1,2,3,4,5 [?]a # 5 ; count array .Pp []a=1,2,3,4,5 [0]a # 1 ; get element .Pp []a=1,2 [0]a=X a # X2 ; replace .Pp []a=1,2 [+0]a=0 a # 012 ; prepend .Pp []a=1,2 [-1]a=3 a # 123 ; append .Pp .Sh AUTHORS .Pp pancake