SDB(1)

πŸ“¦
version 6.2.2 Β· 4 versions
, in alpine 3.24, arch rolling, nixos 26.05, nixpkgs unstable, ubuntu resolute

✨ SDB(1) β€” the manual, but make it slay ✨

okay bestie, sit down, grab a boba, because we're learning sdb β€” a General Commands Manual page, and it's genuinely iconic πŸ’…


πŸŽ€ NAME πŸŽ€

sdb β€” simple key-value database baked by base64, json and arrays

yes. baked. like a lil cake. but it's a database. periodt πŸ“


🌸 SYNOPSIS 🌸

sdb [-0dehjJv] -|db [-|=|==] [.file|expr ..]

look at that lil pattern, it's giving "I contain multitudes" ✨


πŸ’– DESCRIPTION πŸ’–

SDB is a simple disk and memory string-based key-value database. It is based on CDB and uses

  • -d β€” Decode stdin as base64 and prints to result to stdout
  • -D β€” Find differences between two databases
  • -C β€” Create the C and H files for a perfect hash implementation of the contents of the given Sdb
  • -G β€” Create the gperf file used by -C
  • -e β€” Encode stdin in base64 and prints to stdout
  • -h β€” Show help message
  • -j β€” Indent JSON from stdin if no more arguments, otherwise dump database as JSON.
  • -J β€” Enable journaling
  • -h β€” Show help message
  • -v β€” Show version

ngl -h said its thing twice and honestly? relatable. showing up twice, being helpful both times 🫢 (fr fr, that's what the page says, so that's what you get.)


🌈 EXAMPLES 🌈

Some useful ways to run it β€” lowkey these are the main character moments:

$ sdb -                           ; in memory database
$ sdb test.db = < test.txt        ; create database from text file
$ sdb test.db == a.txt b.txt      ; create database from text files in a
single command
$ sdb test.db                     ; dump contents of database
$ sdb test.db a=b a               ; inline queries

Append those quoted commands to sdb - to test these sdb_query expressions:

a=hello b=world a b    # hello world
a=1 +a -a              # 2 1     ; key inc/dec
a={"a":122} a:a=O a    # {"a":0} ; json set
a={"foo":122} +a:foo   # 123     ; json increment
[]a=1,2,3,4,5 [?]a     # 5       ; count array
[]a=1,2,3,4,5 [0]a     # 1       ; get element
[]a=1,2 [0]a=X a       # X2      ; replace
[]a=1,2 [+0]a=0 a      # 012     ; prepend
[]a=1,2 [-1]a=3 a      # 123     ; append

like?? the range of things this lil guy does?? count, get, replace, prepend, append β€” it ate and left no crumbs πŸ‘‘


πŸ‘‘ AUTHORS πŸ‘‘

pancake <pancake@nopcode.org>


and that's the whole vibe, bestie πŸ’œ this was the Debian build, dated Feb 7, 2021 β€” so like, retro but make it cute πŸ¦‹ go forth and sdb responsibly, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from