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

Tim Chase@gumnos@mastodon.bsd.cafe

Christian, husband, father, geek, dork behind @ed1conf

If bsd.cafe requires approval for you to follow me, but you have a default profile-pic and no public post/interaction with other folks on the fedi, it's likely to be a no.

Interests: BSDs, SQL, awk, Python, Go, vi/vim/ed
GPG: A8AC DE26 CB08 38D4 78E2 F9D3 AEA6 D898 A54C 94FF
Location: Dallas area, TX, USA
Webspace: https://blog.thechases.com Joined: 2026-09-16 16:22:06 1 notes, 0 following, 0 followers

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).