LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

rec2csv

Export GNU recutils records to CSV format

TLDR

Convert recfile to CSV
$ rec2csv [file.rec] > [output.csv]
copy
Select specific fields
$ rec2csv -f [field1,field2] [file.rec]
copy
Select record type
$ rec2csv -t [Type] [file.rec]
copy
Include header
$ rec2csv -H [file.rec]
copy

SYNOPSIS

rec2csv [options] [file]

DESCRIPTION

rec2csv converts GNU recutils plain-text database files into CSV format for import into spreadsheets, databases, or other tools that consume tabular data. It reads recfile records (structured as key-value pairs separated by blank lines) and outputs them as comma-separated rows with optional column headers via the -H flag.The -t flag selects a specific record type when a recfile contains multiple types, and -f limits output to specified fields. It can be combined with recsel in a pipeline to first filter records before converting to CSV. Part of the GNU recutils toolkit.

PARAMETERS

-t, --type type

Select record type.
-f, --fields fields
Fields to output (comma-separated).
-H, --headers
Include column headers.
-s, --sort field
Sort by field.
-n, --num n
Limit number of records.

EXAMPLES

$ # Basic conversion
rec2csv contacts.rec > contacts.csv

# With headers
rec2csv -H books.rec > books.csv

# Select fields
rec2csv -f Name,Email,Phone contacts.rec

# Specific type
rec2csv -t Book -f Title,Author library.rec

# With selection
recsel -e "Price > 10" items.rec | rec2csv -H
copy

RECFILE FORMAT

$ Name: John Doe
Email: john@example.com
Phone: 555-1234

Name: Jane Smith
Email: jane@example.com
Phone: 555-5678
copy

INSTALL

sudo dnf install recutils
copy
sudo apk add recutils
copy
brew install recutils
copy
nix profile install nixpkgs#recutils
copy

CAVEATS

Multi-line field values may need special handling. Part of GNU recutils package.

HISTORY

rec2csv is part of GNU recutils by Jose E. Marchesi for managing plain text databases.

SEE ALSO

recsel(1), recins(1), recdel(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid