On 07/02/24 21:59, Dan Andersson wrote:
Hello,

I have three files: 1.beancount, 2.beancount, 3.beancount
Within each file we have a correct date order, but the three files' date ranges could overlap.

How could I combine these files into a single result file while making sure the result has the correct date order?

Beancount does not care about the order in which the entries are ordered by date in the source files (well, almost, the ordering in the source file matters to resolve ties in transaction dates, but in the almost totality of cases this is not a problem).

Sorting the entries by date is necessary only for your convenience.

The easiest way to combine the files is to use the Beancount parser to parse the entries and then serialize them again to file. I've posted very simple scripts that does just this a couple of times on the mailing list already. However, this does not preserve everything that may be in the source files (comments, formatting, some syntax constructs...).

autobean-format is a tool developed outside Beancount that may do this.

I have some elisp code that sorts transactions in Emacs buffers, when I need to do this on smallish portions of ledgers (I should probably merge it into beancount-mode at some point).

Cheers,
Dan

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/fa105b00-883f-4f58-8ff9-e79ef2891424%40grinta.net.

Reply via email to