17.5 Invoking recset

recset manipulates the fields of records in a rec file, or rec data read from standard input. Synopsis:

recset [option]... [file]...

If no file is specified then the command acts like a filter, getting the data from standard input and writing the result to standard output.

In addition to the common options described earlier (see Common Options) the program accepts the following options.

Record selection options:

-i
--case-insensitive

Make strings case-insensitive in selection expressions.

-t
--type=expr

Operate on the records of the given type. If this parameter is not specified then records of any type will be affected.

-n indexes
--number=indexes

Operate on the records occupying the given positions in its record set. indexes must be a comma-separated list of numbers or ranges, the ranges being two numbers separated with dashes. For example, the following list denotes the first, the third, the fourth and all records up to the tenth: -n 0,2,4-9.

-e expr
--expression=expr

A record selection expression (see Selection Expressions). Only the records matched by the expression will be processed.

-q str
--quick=str

Operate on records having a field whose value contains the substring str.

-m num
--random=num

Operate on num random records. If num is zero then operate on all the records.

Field selection options:

-f
--fields=FEX

Field selection expression (see Field Expressions) to select the fields to operate.

Actions:

-s
--set=value

Set the value of the selected fields to value.

-a
--add=value

Add a new field to the selected record with value value.

-S
--set-add=value

Set the value of the selected fields to value. If some of the fields don’t exist in a record, append it with the specified value.

-r
--rename=value

Rename a field; value must be a valid field name. The field expression associated with this action must contain a single field name and an optional subscript. If an entire record set is selected then the field is renamed in the record descriptor as well.

-d
--delete

Delete the selected fields in the selected records.

-c
--comment

Comment out the selected fields in the selected records.

--no-external

Don’t use external record descriptors.

--verbose

Be verbose when reporting integrity problems.

--force

Perform the requested operation even in potentially dangerous situations, or when the integrity of the data stored in the file is affected.