recdel

Delete records from GNU recutils databases

TLDR

Delete matching records
$ recdel -e "[Name = 'John']" [file.rec]
Delete by record type
$ recdel -t [Type] -e "[condition]" [file.rec]
Delete with confirmation
$ recdel -c -e "[Status = 'obsolete']" [file.rec]
Delete first N matches
$ recdel -n [1] -e "[condition]" [file.rec]

SYNOPSIS

recdel [options] [file]

DESCRIPTION

recdel removes records from GNU recutils plain-text database files that match a given selection expression. It supports the same expression syntax as recsel, including equality, regex matching, comparison operators, and logical combinators, allowing precise targeting of records to delete.By default it modifies the file in place, but output can be redirected to stdout for safe previewing. The -c flag prompts for confirmation before each deletion, and -n limits the operation to the first N matching records. Part of the GNU recutils toolkit.

PARAMETERS

-t, --type type

Record type.
-e, --expression expr
Selection expression.
-n, --num n
Delete first n records.
-c, --confirm
Ask for confirmation.
-i, --case-insensitive
Case insensitive matching.

EXAMPLES

$ # Delete by condition
recdel -e "Status = 'deleted'" items.rec

# Delete specific type
recdel -t Contact -e "Email ~ 'spam'" contacts.rec

# Delete with confirmation
recdel -c -e "Price < 0" products.rec

# Delete first match only
recdel -n 1 -e "Name = 'Test'" data.rec

# Dry run (output to stdout)
recdel -e "old = 'yes'" file.rec | less

EXPRESSIONS

$ =       - Equal
!=      - Not equal
~       - Regex match
<, >    - Comparison
&&, ||  - Logical operators

INSTALL

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

CAVEATS

Modifies file in place. Make backups before bulk deletes. Part of GNU recutils.

HISTORY

recdel is part of GNU recutils by Jose E. Marchesi for text-based database management.

SEE ALSO

recsel(1), recins(1), recset(1), rec2csv(1)