plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

sdb.7 (2892B)


      1 .TH SDB 7
      2 .SH NAME
      3 sdb \- simple database format
      4 .SH DESCRIPTION
      5 The simple database (sdb) format is a text-based database format
      6 that is 100% backward compatible with Plan 9's network database (ndb) format.
      7 Database files contain records with attribute=value pairs,
      8 with records separated by blank lines.
      9 .PP
     10 Each record consists of one or more lines.
     11 The first line contains space-separated attribute=value pairs.
     12 Continuation lines begin with whitespace (spaces or tabs) and
     13 contain additional attribute=value pairs for the same record.
     14 .PP
     15 Within a line, attribute=value pairs are separated by spaces or tabs.
     16 The attribute name and value are separated by an equals sign (=).
     17 Attribute names cannot contain equals signs or whitespace.
     18 .PP
     19 Values can be quoted with double quotes to include spaces.
     20 When values are quoted, the following escape sequences are recognized:
     21 \e0 (null), \ef (form feed), \en (newline), \er (carriage return),
     22 \et (tab), \ev (vertical tab), \e" (quote), and \e\e (backslash).
     23 All other bytes, including those with values above 127, can be stored directly.
     24 SDB fully supports binary data.
     25 .PP
     26 When values are not quoted, tabs cannot appear in values as they
     27 are field separators. To include a tab in a value, quote the value
     28 and use \et.
     29 .PP
     30 Comments begin with # and extend to the end of the line.
     31 Comments can appear on their own line or after attribute=value pairs.
     32 .SH PATTERN MATCHING
     33 Several sdb tools support pattern matching for attribute values.
     34 The pattern language includes:
     35 .TP
     36 .B *
     37 Wildcard that matches zero or more characters.
     38 However, a pattern consisting of a single * matches one or more characters.
     39 .TP
     40 .B >
     41 .PD 0
     42 .TP
     43 .B >=
     44 .TP
     45 .B <
     46 .TP
     47 .B <=
     48 .PD
     49 Comparison operators for lexicographic string comparison.
     50 .TP
     51 .B \e*
     52 Literal asterisk (escaped with backslash).
     53 .PP
     54 When a * is followed by a literal character, it finds the first occurrence
     55 of that character in the remaining string and continues matching from there.
     56 .SH EXAMPLES
     57 A simple database of network services:
     58 .IP
     59 .EX
     60 service=http port=80 protocol=tcp
     61 	description="Web server"
     62 
     63 service=https port=443 protocol=tcp
     64 	description="Secure web server"
     65 
     66 service=ssh port=22 protocol=tcp
     67 	description="Secure shell" security=high
     68 .EE
     69 .PP
     70 Using special characters in values:
     71 .IP
     72 .EX
     73 # Tab-separated data
     74 data=raw value="one\ttwo\tthree"
     75 
     76 # Multi-line text
     77 message="First line\enSecond line\enThird line"
     78 
     79 # Path with spaces
     80 file="/home/user/My Documents/report.txt"
     81 
     82 # Binary data with null bytes and high-bit characters
     83 signature="GIF89a\0\0ÿÿ"
     84 checksum="Á¢£¤¥¦§¨©"
     85 .EE
     86 .SH SEE ALSO
     87 .MR ndb (1) ,
     88 .MR ndb (7) ,
     89 .MR sdb (1) ,
     90 .MR sdb (3) ,
     91 .MR sdbr (3)
     92 .SH NOTES
     93 The sdb format is designed to be both human-readable and
     94 suitable for processing with standard Unix text tools.
     95 Single-line record format enables easy sorting and filtering
     96 with tools like
     97 .MR sort (1)
     98 and
     99 .MR grep (1) .