LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

recfmt

Format GNU recutils records with templates

TLDR

Format records with inline template
$ recsel [file.rec] | recfmt "{{Name}}: {{Email}}"
copy
Format records using a template file
$ recsel [file.rec] | recfmt -f [template.fmt]
copy
Select and format specific record type
$ recsel -t [Type] [file.rec] | recfmt "{{Title}} by {{Author}}"
copy

SYNOPSIS

recfmt [options] [template]

DESCRIPTION

recfmt applies a template to records read from standard input. Fields are referenced using double-brace slots like {{FieldName}}. For each input record, one copy of the template is generated with field values substituted. Typically used by piping output from recsel into recfmt.Part of GNU recutils.

PARAMETERS

-f, --file FILENAME

Load the template from a file instead of a command-line argument.
--help
Print help and exit.
--version
Show version and exit.

EXAMPLES

$ # Simple format from recsel output
recsel contacts.rec | recfmt "Name: {{Name}}, Email: {{Email}}"

# From template file
recsel data.rec | recfmt -f report.fmt

# Specific record type with selection
recsel -t Book library.rec | recfmt "{{Title}} by {{Author}}"

# Combine with expression filtering
recsel -e "Status = 'active'" items.rec | recfmt "- {{Name}}"
copy

TEMPLATE SYNTAX

$ {{FieldName}}          - Substituted with field value
copy

TEMPLATE FILE

$ # report.fmt
=== {{Name}} ===
Email: {{Email}}
Phone: {{Phone}}
---
copy

INSTALL

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

CAVEATS

Template syntax differs from other templating systems. Part of GNU recutils.

HISTORY

recfmt is part of GNU recutils by Jose E. Marchesi for flexible record formatting.

SEE ALSO

recsel(1), rec2csv(1), recins(1), recdel(1), recset(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