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 Saiou Email: firstname.lastname@example.org %rec: Package Name: GNU recutils URL: http://www.gnu.org/software/recutils Name: GNU epsilon URL: http://www.gnu.org/software/epsilon
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 URL: http://www.gnu.org/software/recutils Name: GNU epsilon URL: http://www.gnu.org/software/epsilon
By default recsel never outputs record descriptors. This is
because most of the time the user is only interested in the data.
However, using the
-d command line output 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 Saiou 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 non-existing record type is specified in
then recsel does nothing.