Tools to help sort the beancount file by date

81 views
Skip to first unread message

berkes

unread,
Oct 24, 2023, 4:47:01 AM10/24/23
to Beancount
Good day.

I'm looking for a way to sort the transactions and balances in my file by date.

My workflow is that I run some importers, walk through the entries and fix/confirm them. Each importer has its output nicely sorted, but I want to merge all the entries. So that all entries appear by date in the file. I now do this manually and that sucks.

What are my options?

I've tried bean-report -f beancount but that changes far more than just the sort ordering.
I use vim, and that can sort by paragraphs[1],folds[3] or regexes-blocks[3]. All work, but are fragile, require convoluted actions or plugins.

Is there some alternative bean-format that would do this? Did I miss an obvious tool shipped in core? Is there an addon?

I've searched the archives, but surprisingly, did not see an answer. Might be that I did not see it through all the noise (sort|sorting gives many false-positives). So sorry if this has been asked before.

Kind regards,
Happy sorting,
Bèr

[1] https://stackoverflow.com/a/24099468/73673
[2] https://gist.github.com/inkarkat/4145501
[3] https://gist.github.com/PeterRincker/582ea9be24a69e6dd8e237eb877b8978

Brian Lalor

unread,
Oct 24, 2023, 5:50:28 AM10/24/23
to bean...@googlegroups.com
autobean-format will do what you want: https://github.com/SEIAROTg/autobean-format

— 
Brian Lalor (he/him)

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/425e58b4-504c-4b34-a8ab-bc12e66aab65n%40googlegroups.com.

Stefano Zacchiroli

unread,
Oct 24, 2023, 6:38:59 AM10/24/23
to bean...@googlegroups.com
On Tue, Oct 24, 2023 at 01:47:01AM -0700, berkes wrote:
> I'm looking for a way to sort the transactions and balances in my file by
> date.

Not exactly that, but the file_ordering.py plugin here:
https://github.com/zacchiro/beancount-plugins-zack/blob/master/file_ordering.py
verifies that entries in your beancount file are ordered by date.

Cheers
--
Stefano Zacchiroli . za...@upsilon.cc . https://upsilon.cc/zack _. ^ ._
Full professor of Computer Science o o o \/|V|\/
Télécom Paris, Polytechnic Institute of Paris o o o </> <\>
Co-founder & CTO Software Heritage o o o o /\|^|/\
https://twitter.com/zacchiro . https://mastodon.xyz/@zacchiro '" V "'
Reply all
Reply to author
Forward
0 new messages