[Top][All Lists]

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

Re: [bug-recutils] Value Expressions

From: John Darrington
Subject: Re: [bug-recutils] Value Expressions
Date: Tue, 4 Sep 2012 05:13:58 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

On Mon, Sep 03, 2012 at 08:48:47PM +0200, Jose E. Marchesi wrote:
     Hi John.
         I hadn't really thought about the syntax, but your proposoal seems
         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
     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 is always going to be a problem as soon as you introduce any kind of 
which is to be interpreted other than literally.  The obvious answer is, you 
escape the / with a \  Another solution is, to introduce a new option -A; -A 
take a string to be interpreted as a value  expression, -a would be interpreted 

The trick is, like you say, is to find the solution which puts the least 
on the users.

         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 
         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..
Hey!  Who said it was going to be easy?


PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://keys.gnupg.net or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature

reply via email to

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