Re: [gawk] Handling variants of CSV input data formats

Liste des GroupesRevenir à cl awk 
Sujet : Re: [gawk] Handling variants of CSV input data formats
De : mortonspam (at) *nospam* gmail.com (Ed Morton)
Groupes : comp.lang.awk
Date : 27. Aug 2024, 01:49:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vaj7ps$2lph3$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 8/26/2024 7:54 AM, Janis Papanagnou wrote:
snip>
I'd have liked to provide more concrete information here, but I'm at
the moment even unable to reproduce Awk's behavior as documented in
its manual; I've tried the following command with various locales
 $ echo 4,321 | LC_ALL=en_DK.utf-8 gawk '{ print $1 + 1 }'
-| 5,321
 but always got just  5  as result.
You need to specifically TELL gawk to use your locale to read input numbers:
$ echo 4,321 | LC_ALL=en_DK.utf-8 gawk '{ print $1 + 1 }'
5
$ echo 4,321 | POSIXLY_CORRECT=1 LC_ALL=en_DK.utf-8 gawk '{ print $1 + 1 }'
5,321
$ echo 4,321 | LC_ALL=en_DK.utf-8 gawk -N '{ print $1 + 1 }'         5,321
See https://www.gnu.org/software/gawk/manual/gawk.html#Locale-influences-conversions for more info on that.
Regards,
Ed

Date Sujet#  Auteur
25 Aug 24 * [gawk] Handling variants of CSV input data formats11Janis Papanagnou
26 Aug 24 `* Re: [gawk] Handling variants of CSV input data formats10Ed Morton
26 Aug 24  `* Re: [gawk] Handling variants of CSV input data formats9Janis Papanagnou
26 Aug 24   +* Re: [gawk] Handling variants of CSV input data formats4Manuel Collado
27 Aug 24   i`* Re: [gawk] Handling variants of CSV input data formats3Janis Papanagnou
27 Aug 24   i `* Re: [gawk] Handling variants of CSV input data formats2Manuel Collado
27 Aug 24   i  `- Re: [gawk] Handling variants of CSV input data formats1Janis Papanagnou
27 Aug 24   `* Re: [gawk] Handling variants of CSV input data formats4Ed Morton
27 Aug 24    `* Re: [gawk] Handling variants of CSV input data formats3Janis Papanagnou
27 Aug 24     `* Re: [gawk] Handling variants of CSV input data formats2Ed Morton
27 Aug 24      `- Re: [gawk] Handling variants of CSV input data formats1Janis Papanagnou

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal