bug-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

recsel only uses the last -e argument when multiple are given


From: Nabil Maghfur Usman
Subject: recsel only uses the last -e argument when multiple are given
Date: Thu, 3 Dec 2020 04:09:54 +0800

Hi,

First I'd like to say that I am finding recutils to be very handy for my purposes and applaud the work put into it and it's command-line and emacs UX.

I have an issue which I suspect is either a documentation issue or a recutils issue: in the last few paragraphs of the node "Selecting by predicate" (3.5.1) the following is noted

recsel accepts more than one -e argument, each introducing a selection _expression_, in which case the records which satisfy all expressions are selected.

However, testing with a recutils 1.8 installation on Debian Sid, I am unable to achieve the stated behaviour. Instead, only the last -e argument is used to select records.

Suppose you have a file test.rec:

ID: 1
Foo: A
Foo: B

ID: 2
Foo: A

ID: 3
Foo: B

and wish to get the ID for records that have both the fields Foo: A and Foo: B, one should be able to do that with the following recsel invocation where there are several selection expressions passed, one for each Foo field-value pair I'm interested in, and this should only return the first record ID: 1.

$ recsel -e "Foo ~ 'A'" -e "Foo ~ 'B'" -p ID test.rec
ID: 1

ID: 3

As you can see, it actually just returns the records which have Foo: B. And if you swap the -e arguments, the same behaviour is observed where only the last argument is used.

A workaround of course is to pipe multiple invocations of recsel together for each additional _expression_, which is satisfactory for my purposes. Indeed, if the intended behaviour is that recsel accept only one -e argument, this is the solution I would have come to.

Nabil

reply via email to

[Prev in Thread] Current Thread [Next in Thread]