As we saw in the section discussing record descriptors, it is possible to have several different types of records in a single recfile. Consider for example a gnu.rec file containing information about maintainers and packages in the GNU Project:
%rec: Maintainer Name: Jose E. Marchesi Email: email@example.com Name: Luca Saiu Email: firstname.lastname@example.org %rec: Package Name: GNU recutils LastRelease: 12 February 2014 Name: GNU epsilon LastRelease: 10 March 2013
If recsel is invoked in that file it will complain:
$ recsel gnu.rec recsel: error: several record types found. Please use -t to specify one.
This is because recsel does not know which records to
output: the maintainers or the packages. This can be resolved by
-t command line option:
$ recsel -t Package gnu.rec Name: GNU recutils LastRelease: 12 February 2014 Name: GNU epsilon LastRelease: 10 March 2013
By default recsel never outputs record descriptors. This is
because most of the time the user is only interested in the data.
However, with the
-d command line option, the record descriptor
of the selected type is printed preceding the data records:
$ recsel -d -t Maintainer gnu.rec %rec: Maintainer Name: Jose E. Marchesi Email: email@example.com Name: Luca Saiu Email: firstname.lastname@example.org
Note that at the moment it is not possible to select non-typed (default) records when other record sets are stored in the same file. This is one of the reasons why mixing non-typed records and typed records in a single recfile is not recommended.
Note also that if a nonexistent record type is specified in
then recsel does nothing.