help-recutils
[Top][All Lists]
Advanced

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

Backslash at the end of the attribute value


From: František Kučera
Subject: Backslash at the end of the attribute value
Date: Sun, 26 Feb 2023 14:26:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1

Hello,

I am writing a Recfile parser/generator and I am currently stuck at the correct syntax of the \ character at the end of attribute values.

According to the <https://www.gnu.org/software/recutils/manual/Fields.html#Fields> documentation, the \ at the end of the line says, that the value continues on next (physical) line without any (logical) line-end.

In most cases this simple rule works well. But what if the value ends with \ character? How can I say that this \ is not a line continuation but part of the value? If we have for example this CSV:

    $ echo -e 'a,b\na\\,b\nA,B'
    a,b
    a\,b
    A,B

How it should be serialized in Recfile? Running it through csv2rec and recsel unfortunately does not give an answer:

    $ echo -e 'a,b\na\\,b\nA,B' | csv2rec | recsel
    a: ab: b
   
    a: A
    b: B

I can add a space after the \ which avoids the main problem, but it also changes the value ("a\" vs. "a\ ").

Thanks,
Franta


reply via email to

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