Get unique tag values

38 views
Skip to first unread message

thierry

unread,
May 17, 2013, 2:42:32 PM5/17/13
to ledge...@googlegroups.com
Hi,

Here is my example file

-------------------8<-------------------8<-------------------
2012-03-10 * KFC
    Expenses:Food  $20.00
    Assets:Cash
    ; MyTag: This is the first value for MyTag

2012-03-10 * KFC
    Expenses:Food  $20.00
    Assets:Cash
    ; MyTag: This is the second value for MyTag

2012-03-10 * KFC
    Expenses:Food  $20.00
    Assets:Cash
    ; MyTag: This is the second value for MyTag
-------------------8<-------------------8<-------------------

What I want are the *unique* *values* of tag MyTag.

So far, I mangaged to get:

$ ledger --args-only --file /tmp/test_tag.ledger tags  --values --group-by "tag('MyTag')"
MyTag: This is the first value for MyTag
MyTag: This is the second value for MyTag


The group-by trick is the only thing I found to uniquifying the lines.
But what I expect are the two lines below, without the "MyTag: " prefix.

This is the first value for MyTag
This is the second value for MyTag


Is there a ledger only solution ? What I mean is without piping through cut like "| cut -c 8-". I tried --format, but I was not able to find any correct syntax.

Thanks for your answers

Thierry

Craig Earls

unread,
May 17, 2013, 3:00:34 PM5/17/13
to ledge...@googlegroups.com
I added a tags and values option to ledger some time ago. ledger tags
--values will list all tags with values. It will list ALL tags and
values, sort of like the accounts or payees command.
> --
>
> ---
> 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 ledger-cli+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

thierry

unread,
May 17, 2013, 3:22:18 PM5/17/13
to ledge...@googlegroups.com
Thansk Craig, I did try "tags" and "--values".
I managed to get from ALL "key: value" to UNIQUE "key: value".
Now I would like to get from "key: value" to "value" only.
Reply all
Reply to author
Forward
0 new messages