LinuxCommandLibrary

recset

TLDR

Update field value

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

SYNOPSIS

recset [options] [file]

DESCRIPTION

recset modifies field values in GNU recutils files. It can update existing fields or add new ones based on selection criteria.
Part of GNU recutils.

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
copy

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), recutils(7)

Copied to clipboard