Status
HDB 1.0.1 was released on 26 May 2006. This release includes source and binary RPM packages.
Hosted By
SourceForge

 

 

HDB one liners

Some example usages

Set a value in the database
[hampa@hdb]$ hdb-set author/name=Arthur
Fetch a value from the database
[hampa@hdb]$ hdb-get author/name
Arthur
Delete a key from the database
[hampa@hdb]$ hdb-del author/name
Do a flat format dump of data
[hampa@hdb]$ hdb-dump -f
list/key=valueeee
list/key1=value31670
list/key2=value9513
list/key3=value30356
list/key4=value21101
list/key5=value7248
author/name=Arthur
author/name_middle=C
author/sirname=Clark
author/movie/2001/name=Kubrick
author/movie/2001/actor:1/name=Dave
author/movie/2001/actor:3/name=Monkey
author/movie/2001/actor:2/name=Gary
Print all lists with key matching regular expression 'name'
[hampa@hdb]$ hdb-query -k name
./author/name_middle=C
./author/sirname=Clark
./author/movie/2001/name=Kubrick
./author/movie/2001/actor:1/name=Dave
./author/movie/2001/actor:3/name=Monkey
./author/movie/2001/actor:2/name=Gary
The last output we got name_middle and sirname keys.
Let's ommit those keys in the next query
[hampa@hdb]$ hdb-query -k ^name$
./author/movie/2001/name=Kubrick
./author/movie/2001/actor:1/name=Dave
./author/movie/2001/actor:3/name=Monkey
./author/movie/2001/actor:2/name=Gary
Let's print actor nr 1 and 3. We can do this with globbing
[hampa@hdb]$ hdb-query actor:[1,3]
./author/movie/2001/actor:1/name=Dave
./author/movie/2001/actor:3/name=Monkey
Let's delete the actors 1 and 3
[hampa@hdb]$ hdb-query actor:[1,3] | hdb-del
And print the remaining actors names
[hampa@hdb]$ hdb-query actor | hdb-cut -ov
Gary
hdb-filter can be used to parse and replace values in files. This is good with creating /etc/ configurations from database values
echo 'Hello Mr %:DB:author.sirname%' | hdb-filter
Hello Mr Clark
Globbing can be used to easily create lists.
[hampa@hdb]$ hdb-set list/key{1..5}=value$RANDOM
Dump the created list xml like format
[hampa@hdb]$ hdb-dump list
<list>
   key valueeee
   key1 value31670
   key2 value9513
   key3 value30356
   key4 value21101
   key5 value7248
</list>