o1bigtenor <[email protected]> writes:

> On Sun, Dec 22, 2019 at 9:47 AM Richard Lawrence <[email protected]> wrote:

>> But at least in this case you can fake it with regexps:
>>
>> ledger reg --limit 'account =~ /9795\.00\.[0-9][0-8]\.(([0-4][0-9])|50)/'
>>

> Could you possible explain the part from  the first '/' - - - - or - -
> - -point me
> to a reasonably decent guide on how to do this?

I'm not quite sure I understand the question.

'account =~ /something/' is ledger's syntax for an expression that is
true if the account name in a posting matches the regular expression
"something" (the regular expression is everything between the '/'
characters). See section 11.4, "Complex expressions", in the manual.

Basically, the regular expression I gave you says: match any account name

  - that starts exactly with '9795.00.'
  - followed by two digits, where the second digit maxes out at '8'
  - followed by '.'
  - followed by two digits, where either the two match exactly '50', or
    the first maxes out at '4' and the second maxes out at '9'

Is that the explanation you're looking for?

If you don't know how to write regular expressions like this, there are
zillions of guides out there -- you can search the web for one that
works well for you.

This is a pretty cumbersome way to filter on account names, though! If I
were you, I would use human-readable strings as account names, because
it's much easier to filter text with regular expressions (which is
pretty much the only way ledger has to filter by account, as far as I
know).

If you really want to filter using the numbering system you've
developed, you might consider putting those numbers in a metadata field
where you can actually use them as numbers. For example, if you put the
number as the value of a tag in a posting, like

2019/12/12 Some postings
    expenses:Something  €3.00 ; AcctNum: 9795006948
    expenses:Something  €4.00 ; AcctNum: 9795006928
    assets:Cash
 
then you can use a value expression like

to_int(tag("AcctNum")) > 9795006929

as the argument to --limit, which will in this case show you just the
first posting for €3.00. I'd recommend looking over the EXPRESSIONS
section in the ledger manual page to see what other possibilities might
work for you.

Hope that's helpful!

-- 
Best,
Richard

-- 

--- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/87woan8fzr.fsf%40aquinas.

Reply via email to