(Background: in the process of moving from GnuCash; my main draw to ledger is #1 the balance assertions, and #2 that it fits into a typical Linux toolchain, especially that I can use source control for data files.)
I don't know if this is best practice (feedback welcome!) but my current approach to import new transactions is to put them in a file which includes my previous ledger file, and then do 'ledger -f old.ledger --sort d --empty print > new.ledger' to create a new ledger with everything in the right order.
I'm using a lot of balance assertions because I frequently refactor old transactions. I found that balance assertions require the ledger to be fully sorted, so I can't avoid this rewriting step. I found this refactoring to be very painful in GnuCash precisely because it doesn't have the ability to do balance assertions, so anytime the current balance didn't line up I would have to do a laborious binary search through the account history to figure out where things went wrong.
My problem now is that balance assertions aren't preserved when using 'print'... so my rewriting step doesn't work because it doesn't preserve all the information in the ledger.
What should I do? Is there a flag similar to '--empty' that will tell ledger to preserve the balance assertions? This would actually be a showstopper for me, if I was unable to import new transactions and still preserve old transactions.
Thanks,
Mike.