--
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 post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/20180627162747.18858.25492%40celery-worker-110.ash1.bb-inf.net.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAKaOXii_ukvaOLdNKmVWgJPai-LxO8b%2BXLdOLHCRM26kptJhGQ%40mail.gmail.com.
I've often wanted to sort my bean file, thoughi acknowledge that is mostly just OCD and I can always get a sorted view via fava and other UIs.
$ cat sort-txns.py
#!/usr/bin/env python3
from beancount import loader
from beancount.parser import printer
from beancount.core import data
import sys
entries, errors, options = loader.load_string(sys.stdin.read())
for entry in data.sorted(entries):
printer.print_entry(entry)
--
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 post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/04d5881e-c1f9-4c32-85c3-88128a6b209d%40googlegroups.com.
It reads the transactions from stdin.That means I can select the transactions I want to sort in VIM and then do :'<,'>!./sort-txns.py, which replaces the selected text with sorted transactions. Do note that comments are not carried over (since they're essentially ignored by the parser).