On Mon, Dec 23, 2019 at 4:59 AM Richard Lawrence <[email protected]> wrote:
>
> 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?

This was what I was looking for - - - thank you!
>
> 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.

I had done some looking and wasn't finding anything that was as
succinct as what you gave above. Trying to learn how to use a computer
language thoroughly in a few hours is not easy and your explanation has
enough information so that I could rewrite what you offered to fit the other
instances that I need it. Likely what I'll be doing is rewriting the expression
to make it quite generic (subaccounts can range to 99) and then just
save the expressions as a group for use when I'm doing my record keeping.

The only concern I have is that I have no real way of 'error checking' what
I will produce but that might be an exercise in doing lots of addition
- - - grin.

>
> 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).

Hmmmmmmmmm - - - - as to the numbers being cumbersome - - - I will
translate one number into its 'human readable' text:
Machinery fuel and lubricants: Lubricants: chain saw bar lube oil: winter oil
or numerically 9794.20.91.02
I am already using about 95 columns for my text file - - - - if I were
to want to
go to the expanded text system I would need likely about 160.

if you've ever run into 'GIFI codes' (General Index of Financial Information'
IIRC) you would recognize the first 4 digits - - - they are for machinery fuel
and lubricants - - - - the following are my attempt at devising an account
system.

>
> 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.

I am using what looks something like this
2019.12.12     Some posting
expenses: winter bar oil: 9794.20.91.02                         $         3.00
assets: cash: 1001.00.00.01                                         $
        -3.00

>
> Hope that's helpful!

Yes your responses have been very helpful!!!

Thanking you for your sharing - - - - praying for a right wonderful Christmas
and a blessed New Year for you and yours!

-- 

--- 
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/CAPpdf5-LTonTBmwa1CR8s8dnMxvz47Wps8Qx3C_0Vn4qqf1GZg%40mail.gmail.com.

Reply via email to