LinuxCommandLibrary

recdel

TLDR

Delete matching records

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

SYNOPSIS

recdel [options] [file]

DESCRIPTION

recdel deletes records from GNU recutils files matching a selection expression. It modifies the file in place unless outputting to stdout.
Part of GNU recutils.

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
copy

EXPRESSIONS

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

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)

Copied to clipboard