filter based on related (other "side")?

35 views
Skip to first unread message

Alan

unread,
Jan 25, 2021, 6:03:28 PM1/25/21
to Ledger
Is there some way to select entries by matching each "side" of the transaction?

For example, list expenditures to "Expenses:Food" but not all of them; only the ones that were charged against "Liabilities:Credit Card."

I tried `ledger reg exp.*food and liab.*credit.card` but that turns up nothing.

My workaround is to display "--related" and then pipe it to grep; but sometimes that's not quite perfect.

Ismael Bouya

unread,
Jan 25, 2021, 7:16:30 PM1/25/21
to ledge...@googlegroups.com
That’s a question that popped earlier this month :)

reg Expenses:Food -l "any(account =~ /Liabilities:Credit Card/)"

Note that it catches *any* other side, in case where your transaction
has more than two lines it works too.

(Mon, Jan 25, 2021 at 03:03:28PM -0800) Alan :
--
Ismael
signature.asc
Reply all
Reply to author
Forward
0 new messages