[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: Thu, 6 Sep 2012 07:51:26 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

On Tue, Sep 04, 2012 at 10:36:20AM +0200, Jose E. Marchesi wrote:
              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 expression
         which is to be interpreted other than literally.  The obvious answer 
is, you must 
         escape the / with a \  Another solution is, to introduce a new option 
-A; -A would
         take a string to be interpreted as a value  expression, -a would be 
         The trick is, like you say, is to find the solution which puts the 
least confusion
         on the users.
     Yes.  We need more ideas.

Well I think it should be similar to other GNU utilities.  And I think that 
recset is somewhat
analagous to sed and to tr, so the syntax ought to be familar to users of those 
utilies.  Agreed?

So to set a fieldvalue to something based on another fieldvalue:

# Add an email address based on first and last names
recset  -f EMail -[aSa] 'address@hidden'

# Mutate all email addresses to lower case
recset -f Email -s '{Email}/[:upper:]/[:lower:]/'

# Our company rules say that email addresses may not begin with a digit.  So 
prepend an X
recset -f Email -s '{Email}/^\([0-9])/X\1/'

This does not address the problem of somebody who wants to insert a literal 
'{FieldName}' or similar.
I don't think this would happen very often. But they could to it with:

recset -f Email -s '\{Email\}'

In addition you could introduce a new option -l which means all further values 
to be interpreted 

# Add an Email address based on the first and last names, and  a password of 
recset  -f Email -a 'address@hidden' -l -f Password -a '{xfk%}$sO0/g' 

Would that cover most use cases?

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]