On Fri, Nov 01, 2013 at 07:02:10PM -0700, Vladimir Parfinenko wrote:
> Thank you, David, your solution works!
> 
> However the following solution is simpler and looks suitable:
> 
>     $ ledger bal -T 'a'

My pleasure, Vladimir.  I was going to tell you about -T a, but I
noticed that it deviated from your desired output in one important way:
the final total amount is always zero---even when it shouldn't be.

For example (using my personal ledger file):


    ## Regular run
    $ ledger -p 'this week' bal expenses | tail -n 1
             $281.38

    ## With -T a
    $ ledger -p 'this week' bal expenses -T a | tail -n 1
                   0

    ## With -T '(l==0)?O:a'
    $ ledger -p 'this week' bal expenses -T '(l==0)?O:a' | tail -n 1
             $281.38

Ledger seems to consider the final total a top-level account (depth
equaling zero), so it will probably always calculate to zero with 'a'.
The value expression '(l==0)?O:a' tests for that and uses the regular
value expression, 'O', for the total and 'a' for the rest of the
accounts.

But if you don't need that final total, "-T a" is sure a lot easier
to remember!

-Dave
-- 
David A. Harding

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to