bug-recutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-recutils] Value Expressions


From: Jose E. Marchesi
Subject: Re: [bug-recutils] Value Expressions
Date: Mon, 03 Sep 2012 20:48:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Hi John.

    I hadn't really thought about the syntax, but your proposoal seems
    reasonable.
    
    Some hypotheitical use cases that I can think of are:
    
    # Add a field for a person's retirement date.
    recset -e 'Gender = Male' -f Retires -a '/date-of-birth + 65 years'
    recset -e 'Gender = Female' -f Retires -a '/date-of-birth + 55 years'
    
    # Add an a second email address to all those who work at foo.com
    recset -e 'Email[0] = "address@hidden"'  -f Email -a
    '/Email[0]/s/@foo.com/address@hidden/'

Looks good but, what if you want to add a value that starts with a /
character?  We must find a simple, complete and easy to learn syntax for
this...
    
    but we don't know if the element 0 is the one where the target is, so we 
need some 
    kind of positional parameter:
    
    recset -e '\(Email\) ~ "address@hidden"'  -f Email -a 
'/\1/s/@foo.com/address@hidden/'
    
    Here, the \1 represents the first field in the -e expression enclosed in ()
    So a more complex example:
    recset -e '#(first-name)' -e '#(last-name)' -e '#(company)' -f Email -a 
'address@hidden'

Huh... that would require to capture snapshots of the records in the
evaluation of the SEX.  Complex stuff..

-- 
Jose E. Marchesi         http://www.jemarch.net
GNU Project              http://www.gnu.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]