recsel reads the given rec files (or the data in the
standard input if no file is specified) and prints out records (or
part of records) based upon some criteria specified by the user.
recsel searches rec files for records satisfying certain
recsel [option]… \ [-n indexes | -e record_expr | -q str | -m num] \ [-c | (-p|-P|-R) field_expr] \ [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.
The following global options are available.
Make string matching case-insensitive in selection expressions.
Do not section the result in records with newlines.
Print record descriptors along with the matched records.
Try to decrypt confidential fields with the given password.
Sort the output by the comma-separated list of field names,
fields. This option takes precedence over any sorting criteria
specified in the corresponding record descriptor with
Remove duplicated fields in the output records. Fields are duplicated if they have the same field name and the same value.
Group the output records by the provided comma-separated list of fields. Grouping is performed before sorting.
The selection options are used to select a subset of the records in the input.
Match the records occupying the given positions in its record set. indexes must be a comma-separated list of numbers or ranges, with 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’.
A record selection expression (see Selection Expressions). Only the records matched by the expression will be taken into account to compute the output.
Select records having a field whose value contains the substring str.
Select num random records. If num is zero then select all the records.
Select records of a given type only.
Perform an inner join of the record set selected by -t and
the record set for which field is a foreign key. field
must be a field declared with type
rec and thus must be a
foreign key. If a join is performed then any selection expression and
field expression operate on the joined record sets.
The output options are used to determine what information about the selected records to display to the user, and how to display it.
List of fields to print for each record. name_list is a list of field names separated by commas. For example:
means to print the Name and the Email of every matching record, both the field names and values.
If this option is not specified then all the fields of the matching records are printed to standard output.
Same as ‘-p’, but print only the values of the selected fields.
Same as ‘-P’, but print the values separated by single spaces instead of newlines.
If this option is specified then
recsel will print the number of
matching records instead of the records themselves. This option is
incompatible with -p, -P and -R.
This special option is available to ease the communication between the recutils and other programs, namely Lisp interpreters. This option is not intended to be used by human operators.
Print the data using sexps instead of rec format.