bug-gawk
[Top][All Lists]
Advanced

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

[bug-gawk] Sample code in Gawk manual section 6.1.4


From: Hermann Peifer
Subject: [bug-gawk] Sample code in Gawk manual section 6.1.4
Date: Wed, 30 Jan 2013 23:23:51 -0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130107 Thunderbird/17.0.2

Hi,

I believe that 2 examples in this section do not work as described in the manual. For running the tests, I changed my locale to [1].

> awk 'BEGIN { printf "%g\n", 3.1415927 }'
3.14159  # not 3,14159, as stated in the manual

> echo 4,321 | gawk '{ print $1 + 1 }'
5  # not 5,321, as stated in the manual

The examples only work as documented after adding the --use-lc-numeric switch.

> awk --use-lc-numeric 'BEGIN { printf "%g\n", 3.1415927 }'
3,14159

> echo 4,321 | gawk --use-lc-numeric '{ print $1 + 1 }'
5,321

Hermann

[1]
> locale
LANG="da_DK.UTF-8"
LC_COLLATE="da_DK.UTF-8"
LC_CTYPE="da_DK.UTF-8"
LC_MESSAGES="da_DK.UTF-8"
LC_MONETARY="da_DK.UTF-8"
LC_NUMERIC="da_DK.UTF-8"
LC_TIME="da_DK.UTF-8"
LC_ALL="da_DK.UTF-8"

> gawk -V
GNU Awk 4.0.73 (GNU MPFR 3.1.1-p2, GNU MP 5.0.5)



reply via email to

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