help-recutils
[Top][All Lists]
Advanced

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

Re: Allow '-' in field names? Support for Debian's multi-line format?


From: František Kučera
Subject: Re: Allow '-' in field names? Support for Debian's multi-line format?
Date: Sun, 26 Feb 2023 15:16:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

Dne 26. 01. 23 v 12:29 Jose E. Marchesi napsal(a):
We add an alternative syntax to selection expressions that allows '-'
   in field names, such as lisp-like

SQL allows almost anything (including spaces) when you put the name in the 
double quotes:

SELECT "retail-price" - 50 AS "discounted-price"
FROM (SELECT 200 AS "retail-price")

This is bit ugly in shell scripts, when you need both ' and " and have to 
escape one of them... but still better than not being able to work with such 
attributes.

> We expect '-' normalized to '_' when referring to field names in selection 
expressions

I saw that csv2rec already converts spaces to _ and gives up on other characters (like Unicode ones). Hyphen 
can also be converted to _, but then it is ambiguous because original "a x" and "a_x" 
attributes will become same "a_x" in Recfile. Is there a recommended way to convert an arbitrary 
string to a valid Recfile name?

I do it currently this way: "_" becomes "__", anything unsupported becomes "_<UnicodeCodepoint>_" 
e.g. "a x" becomes "a_32_x". Yes, it is bit ugly, but it allows me to encode anything as a Recfile.

Franta




reply via email to

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