ledger print and per-account “comments”

437 views
Skip to first unread message

Michael Norrish

unread,
Nov 4, 2012, 10:13:51 PM11/4/12
to Ledger
My file has quite a few txns of the following form

date * text
   account-name  amount  ; foo
   some-other-account-name

Curiously, when I do a ledger print, some of the “foo” comments are preserved and some (a minority) are not.

What’s the rule governing this?

Thanks,
Michael

Craig Earls

unread,
Nov 4, 2012, 10:16:45 PM11/4/12
to ledge...@googlegroups.com
All comments within transactions should be preserved, but they may be on the next line.  Comments outside of transactions are not preserved.
--
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

Michael Norrish

unread,
Nov 4, 2012, 10:44:43 PM11/4/12
to Ledger
Ah, I was using grep to look at particular accounts, and yes, they'd been moved to the next line.

Thanks for that.

Clearly, I shouldn't have been using grep.  What's the right way to get reg or bal to show me those comments?

Best,
Michael

Craig Earls

unread,
Nov 5, 2012, 7:19:10 AM11/5/12
to ledge...@googlegroups.com
For the register command, you can brew up a custom format that will show you notes, for example:

ledger reg --format "%(date) %(payee) %(amount) %(note)\n"  Auto

Will show all the car expenses I have with the accompanying notes.

The balance command aggregates transactions, so showing comments is not obviously sensible.

thierry

unread,
Nov 5, 2012, 1:48:23 PM11/5/12
to ledge...@googlegroups.com
On Monday, November 5, 2012 4:13:53 AM UTC+1, Michael Norrish wrote:
Curiously, when I do a ledger print, some of the “foo” comments are preserved and some (a minority) are not.
What’s the rule governing this?

I believe the rule is "if total characters of the line is superior to something like 80, then wrap the comment".
The trick I used to suppress this wrapping is "ledger --columns=999 print". It works until 999...

Thierry
Reply all
Reply to author
Forward
0 new messages