recutils
Офигенная маленькая база данных на человекочитаемых и -редактируемых текстовых файлах.
- https://www.gnu.org/software/recutils/manual/ - мануал
- https://www.gnu.org/software/recutils/rec-mode-manual/rec-mode.html - мануал к емаксовому моду.
- https://dev.to/jcolag/recutils-the-plain-text-database-52ma - симпатичный рассказ на английском об основах
recsel -e "place = 'мск' && school = 'yes'" base.rec
Пример запроса к базе. Отбор по двум полям, из которых одно с текстовым значением, другое - булево.
Мне нравится возможность держать такую базу как часть оргмодного файла, в src-блоках между текстом. И при желании-необходимости - танглить и выполнять какие там бишь понадобятся операции именно с базой.
Начатки о формате
The separator between the field name and the field value is a colon followed by a blank character (space and tabs, but not newlines). The name of the field shall begin in the first column of the line.
A field name is a sequence of alphanumeric characters plus underscores (_), starting with a letter or the character %. The regular expression denoting a field name is: [a-zA-Z%][a-zA-Z0-9_]*
.
Field names are case-sensitive. Foo
and foo
are different field names.
The value of a field is a sequence of characters terminated by a single newline character (\n).
It is possible to physically split a logical line by escaping a newline with a backslash character, as in:
LongLine: This is a quite long value \ comprising a single unique logical line \ split in several physical lines.
The sequence \n
(newline) +
(PLUS) and an optional _
(SPACE) is interpreted as a newline when found in a field value. For example, the C string bar1\nbar2\n bar3
would be encoded in the following way in a field value:
Foo: bar1 + bar2 + bar3