Home | Notifications | New Note | Local | Federated | Search | Logout

Note Detail


Tim Chase@gumnos@mastodon.bsd.cafe (2026-09-16 08:29:28)
Huzzah!  I've been slowly moving my #plaintextaccounting workflow from the appears-to-be-sloppifying ledger(1)  to hledger(1) which @simonmic seems to lovingly maintain by hand.

One of the reports I've run on occasion is a monthly (-M) or weekly (-W) breakdown of average-spending in particular categories¹. But there were some quirky edges in ledger(1) that meant that running the report for a parent category didn't roll up all the child-categories under it (so using the "-3"-style depth-limiting ended up only printing things at that level, excluding deeper child postings). So my saved command was a convoluted pipeline like

$ ledger print $PARENT_CATEGORY | sed 'substitution that strips off the child-categories with duplicated strings from $PARENT_CATEGORY' | ledger -f - reg -AM

It was a pain to play around with exploration because I had to update the parent and child-parent-stripping parts of the thing rather than just update it once.

I went to run the same report in hledger and tested the naïve command that I'd originally wanted, and it worked like a charm:

$ hledger -f wrapper.txt register Expenses:Household:Food -AM -3

Want to check average grocery-spend for each week?

$ hledger -f wrapper.txt register Expenses:Household:Food:Grocery -AW -4

compared with takeout?

$ hledger -f wrapper.txt register Expenses:Household:Food:Takeout -AW -4

And it delightfully answers the "How much does our household spend on food per month/weekly?" with much less effort than before. 🤗

⸻
¹ In case you're curious, it works out to ~$145/wk for groceries and $54/wk for takeout, or just a little over $200/wk average to feed our family of four (or about $2.40/person/meal).
Reply

---Replies---
bpl@bpl@snac.bsd.cafe (2026-09-16 16:20:47)
from the appears-to-be-sloppifying ledger(1) to hledger(1)

https://hledger.org/AI.html

Hmm...