Filter report by "source" and "destination"

17 views
Skip to first unread message

Tobias Pfeiffer

unread,
Oct 13, 2019, 2:32:19 AM10/13/19
to ledge...@googlegroups.com
Hi,

I want to get all the transactions where money went from account X to
account Y. The documentation has an example like this:

ledger -M -r --display 'account=~/mastercard/' reg ^expenses

However, as the docs mention, running total is off, and there are
occasionally other things showing up in that report that I don't want
to have there. I have tried changing `--display` to `--limit`, but then
the result is always empty.

Since there can be more than two postings per transactions, I
understand that it may be difficult to generally speak of "source" and
"destination", but is there any hack to filter for exactly the
transactions that went, to stay with the above example, from Mastercard
to Expenses, and have the sum correct?

Thanks
Tobias

Martin Michlmayr

unread,
Oct 13, 2019, 2:58:22 AM10/13/19
to ledge...@googlegroups.com
* Tobias Pfeiffer <tgpfe...@web.de> [2019-10-13 15:32]:
> I want to get all the transactions where money went from account X to
> account Y. The documentation has an example like this:
>
> ledger -M -r --display 'account=~/mastercard/' reg ^expenses
>
> However, as the docs mention, running total is off, and there are
> occasionally other things showing up in that report that I don't want
> to have there. I have tried changing `--display` to `--limit`, but then
> the result is always empty.

Does this query more closely give the result you want?

ledger reg "^expenses" -l "any(account =~ /mastercard/)"

--
Martin Michlmayr
https://www.cyrius.com/

Tobias Pfeiffer

unread,
Oct 13, 2019, 4:36:22 AM10/13/19
to ledge...@googlegroups.com
Hi,

Am Sonntag, den 13.10.2019, 08:58 +0200 schrieb Martin Michlmayr:
> * Tobias Pfeiffer <tgpfe...@web.de> [2019-10-13 15:32]:
> > ledger -M -r --display 'account=~/mastercard/' reg ^expenses
> >
> > However, as the docs mention, running total is off, and there are
> > occasionally other things showing up in that report that I don't
> > want to have there. I have tried changing `--display` to `--limit`,
> > but then the result is always empty.
>
> Does this query more closely give the result you want?
>
> ledger reg "^expenses" -l "any(account =~ /mastercard/)"

That works perfectly, thank you very much!

Thanks
Tobias

Reply all
Reply to author
Forward
0 new messages