
problem: decimal separators in gawk on a German windows installation
I have a problem with my version of (GNU) awk and decimal separators
under windows.
I am running what, s far as I can tell, is an absolutely standard
version of the gawk 3.1.0 binary compiled for windows) downloaded from
an American site. Crucially, the program is running on a German
version of windows.
My problem is that this program insists on using comma (,) as a
decimal separator instead of point (.).
I am assuming (intelligent guess) that strtod dynamically configures
itself at startup to have this behaviour after detecting that it is
running on a German machine and setting the decimal separator to
comma.
Example code:
test.awk:
-+-
{printf "|%s|%s|%s|\n", $1+0,$2+0,$2}
-+-
test.dat:
-+-
1,6;1.6;
-+-
awk -F ; -f test.awk test.dat
-+-
|1,6|1|1.6|
-+-
I do not have the alternative of recompiling the binary; Is there
anyway that I can override this effect, and set periods as decimal
separators?
Also, could suggestions please be cc'ed to me at my mail address
news.
Many thanks in advance,
Sean Matthews
ps. An interesting - though not currently important - secondary effect
is that I cannot, for instance, hardwire floating point numbers into
my awk scripts at all - gawk reads, say, /2.6/ in the program source,
applies - I assume - strtod to it, and gets /2/.
--
Sean Matthews