SWick

A table tennis power machine

Entries tagged "recutils".

recutils im LinuxUser Magazin
26th December 2011

Im LinuxUser Magazin ist ein Artikel zu recutils erschienen:

Die Beispiele stammen aus dem Debian Paket.

Im Artikel gehen sie leider nicht weiter auf das Encryption Feature ein, das nach einem Feature Request in die 1.4 eingeflossen ist.

Die 1.4 ist mittlerweile in Debian Testing und für Arch gibt es auch schon ein PKGBUILD im AUR.

Die 1.5 ist für Januar angekündigt...

Tags: db, nosql, recutils.
GNU recutils 1.5 ist da
14th January 2012
The changes in this release are:

- The utilities will now ask interactively for a password if it was
  not provided with the -s command line option.  This avoids security
  problems related to shell history files.

- Support for octal and hexadecimal numbers has been added.  They can
  be used in both the records and selection expressions.

- It is now possible to select a given number of random records in
  many of the utilities using the -m command line option.

- The -n option now accepts a list of indexes, supporting ranges.

- The new -U (uniq) option for recsel removes duplicated fields in the
  output records.

- The new -q (quick) option allows to quickly search for the desired
  record without having to provide a complete selection expression.

- Auto generated fields are now considered integers by default.  This
  avoids repetitive patterns in record descriptors involving %auto and
  %type.

- Tab characters are now allowed in blank lines betwwen records.

- The API in rec.h is now better documented with comments, and
  improved.

- recfix now exits with an error status if there is a parse error in
  some input file.

- The usage of the internal data structures has been _vastly_
  improved, resulting in a much faster operation.

- Internal cleanup and code factorization.

- Many, many, many bug fixes :D

Tags: db, nosql, recutils.
recutils JSON output
8th June 2014

Quick Python one-liner to get JSON output from recutils

data.rec

%rec: movies

Id: 4
Title: Banana Joe
Country: Italy  |  West Germany
Date: 1982
Director: Steno
Genre: Comedy
Length: 93
Add_date: 05/06/2008
Audio: German (MP3)
Identifier: 141
Location: Box 1
Media: DVD
Amount_of_Media: 1
Rating: 6
Video_file: /media/cdrom0/Banana-Joe.avi
Video_format: DX50
Viewed: 1
Borrower: none
Favourite: 0

Id: 2
Title: Baraka
Country: USA
Date: 1992
Director: Ron Fricke
Genre: Documentary
Length: 96 min
Add_date: 04/06/2008
Identifier: 858
Location: Box 1
Media: CD
Amount_of_Media: 1
Rating: 0
Video_file: /media/cdrom0/Baraka.avi
Video_format: divx
Viewed: 1
Borrower: none
Favourite: 0

Python one-liner

$ rec2csv data.rec | python -c 'import csv,json,sys; print(json.dumps(list(csv.DictReader(sys.stdin)), indent=4))'

Output

[
    {
        "Rating": "6", 
        "Identifier": "141", 
        "Title": "Banana Joe", 
        "Add_date": "05/06/2008", 
        "Country": "Italy  |  West Germany", 
        "Favourite": "0", 
        "Video_file": "/media/cdrom0/Banana-Joe.avi", 
        "Amount_of_Media": "1", 
        "Director": "Steno", 
        "Genre": "Comedy", 
        "Length": "93", 
        "Location": "Box 1", 
        "Borrower": "none", 
        "Media": "DVD", 
        "Date": "1982", 
        "Video_format": "DX50", 
        "Audio": "German (MP3)", 
        "Id": "4", 
        "Viewed": "1"
    }, 
    {
        "Rating": "0", 
        "Identifier": "858", 
        "Title": "Baraka", 
        "Add_date": "04/06/2008", 
        "Country": "USA", 
        "Favourite": "0", 
        "Video_file": "/media/cdrom0/Baraka.avi", 
        "Amount_of_Media": "1", 
        "Director": "Ron Fricke", 
        "Genre": "Documentary", 
        "Length": "96 min", 
        "Location": "Box 1", 
        "Borrower": "none", 
        "Media": "CD", 
        "Date": "1992", 
        "Video_format": "divx", 
        "Audio": "", 
        "Id": "2", 
        "Viewed": "1"
    }
]
Tags: db, nosql, python, recutils.

RSS Feed

"People said I should accept the world. Bullshit! I don't accept the world." -- Stallman