How about this?
ledger bal -l 'commodity == "VIFSX"' --format "%(quantity(display_total))\n"

It looks like there's a bunch of predicates in section "10.4.3
Quantities and Calcuations" in the docs that don't really have
explanations yet, but quantity() looks like it does what you want.

On Sun, Oct 30, 2011 at 11:11 AM, Martin Michlmayr <[email protected]> wrote:
>
> Doesn't adding -n do what you want?  Or possibly "-n Assets".
>
>
> * Craig Earls <[email protected]> [2011-10-30 10:53]:
> > Thanks, that's getting closer.  I really want the output to be a single
> > line showing only the total number of shares (and the commodity if I can't
> > avoid it)  e.g.
> >
> > > ledger bal --limit "commodity == 'VIFSX'"
> > 250.0000
> >
> > or
> >
> > > ledger bal --limit "commodity == 'VIFSX'"
> > 250.0000 VIFSX
> >
> >
> > If I try to control it using a format statement
> >
> > 10:50:17 ~/FinanceData > ledger  bal -l "commodity == 'VIFSX'" --format
> > "%(strip(display_total))\n"
> > 250.0000 VIFSX
> > 125.0000 VIFSX
> > 125.0000 VIFSX
> > 250.0000 VIFSX
> >
> > Which reflects the sub accounts.  I suppose I could just ignore all but the
> > first line, but there must be a way to limit it to the top level account.
> >
> >
> >
> > On Sun, Oct 30, 2011 at 10:07, Peter Keen <[email protected]> wrote:
> >
> > > Try this:
> > >
> > > ledger bal -l 'commodity == "VIFSX"'
> > >
> > >
> > > On Sun, Oct 30, 2011 at 9:01 AM, Craig Earls <[email protected]> wrote:
> > >
> > >> This returns nothing for me
> > >>
> > >> 08:58:30 ~/FinanceData > ledger  bal -l "commodity = 'VIFSX'"
> > >> 08:58:44 ~/FinanceData > ledger  bal -l "commodity = VIFSX"
> > >> 08:58:50 ~/FinanceData >
> > >>
> > >> I have several shares of VIFSX reported in the balance report.  This is
> > >> for ledger 3.0
> > >>
> > >>
> > >> On Sun, Oct 30, 2011 at 01:59, Martin Michlmayr <[email protected]> wrote:
> > >>
> > >>> * Craig Earls <[email protected]> [2011-10-29 21:36]:
> > >>> > This is killing me and it should be simple.  I want to have ledger
> > >>> > tell me how much of a particular commodity I have?
> > >>>
> > >>> ledger -f - bal -l "commodity = 'AUD'"
> > >>>
> > >>> --
> > >>> Martin Michlmayr
> > >>> http://www.cyrius.com/
> > >>>
> > >>
> > >>
> > >>
> > >> --
> > >> Craig, Corona De Tucson, AZ
> > >> enderw88.wordpress.com
> > >>
> > >
> > >
> >
> >
> > --
> > Craig, Corona De Tucson, AZ
> > enderw88.wordpress.com
>
> --
> Martin Michlmayr
> http://www.cyrius.com/

Reply via email to