recset

Update field values in GNU recutils databases

TLDR

Update field value
$ recset -f [Field] -v "[new_value]" -e "[condition]" [file.rec]
Set field in all records
$ recset -f [Status] -v "[active]" [file.rec]
Update specific type
$ recset -t [Type] -f [Field] -v "[value]" -e "[condition]" [file.rec]
Add field if missing
$ recset -a -f [NewField] -v "[value]" [file.rec]

SYNOPSIS

recset [options] [file]

DESCRIPTION

recset modifies field values in GNU recutils plain-text database files, updating existing fields or adding new ones based on selection expressions. It uses the same expression syntax as recsel to target specific records, then sets the specified field to a new value.The -a flag adds the field only to records where it does not already exist, and -n limits updates to the first N matching records. Without a selection expression, all records in the file are updated. The file is modified in place. Part of the GNU recutils toolkit.

PARAMETERS

-t, --type type

Record type.
-f, --field name
Field to set.
-v, --value value
New value.
-e, --expression expr
Selection expression.
-a, --add
Add field if missing.
-n, --num n
Update first n matches.

EXAMPLES

$ # Update matching records
recset -f Status -v "completed" -e "Status = 'pending'" tasks.rec

# Update all records
recset -f Updated -v "$(date)" data.rec

# Update specific type
recset -t Contact -f Phone -v "555-0000" -e "Name = 'John'" contacts.rec

# Add field if not exists
recset -a -f Category -v "General" -e "!Category" items.rec

# Update first match
recset -n 1 -f Priority -v "high" -e "Status = 'new'" tasks.rec

INSTALL

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

CAVEATS

Modifies file in place. Use selection expressions carefully. Part of GNU recutils.

HISTORY

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

SEE ALSO

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