Top Qs
Timeline
Chat
Perspective

Recutils

Toolset for using plain text files as a database From Wikipedia, the free encyclopedia

Remove ads

Recutils, from GNU Project, is a free command-line toolset for performing basic relational database operations on plain text files[2][3] including field typing, auto-increment, and join. Storage files known as recfiles confirm to a file format defined by the toolset. As plain text, recfiles can be edited via a text editor (as long it supports the character encoding). Various other software libraries support the format.[4][5][6]

Quick Facts recfiles, Filename extension ...
Quick Facts GNU Recutils, Original author(s) ...

A recfile is a text file with empty lines between records. Each field of a record is a line starting with the field name and a colon. Multiple record types can be in a single file. A long line can be wrapped (i.e. for readability).

Tools include:

  • recsel – Search for and print fields from records matching a query
  • recins – Insert a record, or replace existing records
  • recdel – Delete a record, or delete a set of records
  • recfix – Sort records
  • recset – Add or update individual fields
Remove ads

Example

The following is formatted as a recfile.

%rec: Text
%type: Year int

Author: Doug McIlroy
Year: 1964
Note: The Origin of Unix Pipes

Title: Unix Text Processing
Author: Dale Dougherty
Author: Tim O'Reilly
Year: 1987
Publisher: Hayden Books

Author: William Shakespeare
Title: Hamlet
Year: 1599
Year: 1600
Year: 1601

The following command selects records where a year field is greater than 1900 and outputs the author field values. The first two records have a year greater than 1900 so are selected. The first record has a single author and the second has two, so the result is three author names.

$ recsel -e 'Year > "1900"' -p Author
Author: Doug McIlroy
Author: Dale Dougherty
Author: Tim O'Reilly
Remove ads

See also

  • asciidoc – Human-readable document format
  • Flat-file database – Database held in an unstructured file
  • org-mode – Open source mode for GNU Emacs
  • TOML – Configuration file format

References

Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.

Remove ads