problem: decimal separators in gawk on a German windows installation 
Author Message
 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



Tue, 03 May 2005 21:44:05 GMT  
 problem: decimal separators in gawk on a German windows installation

Quote:

> 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.

Dunno, but 'man awk' tells this:

 A number is converted to a string by using the value of CONVFMT as a
 format string for sprintf(3), with the numeric value of the variable
 as the argument.  However, even though all numbers in AWK are
 floating-point, integral values are always con- verted as integers.
 Thus, given CONVFMT = "%2.2f" a = 12 b = a ""

So try fiddling with CONVFMT a bit.



Wed, 04 May 2005 01:52:26 GMT  
 problem: decimal separators in gawk on a German windows installation


...

Try changing the "Decimal Symbol" in your Windows Regional Settings to "."

Control Panel/Regional Options/Number Format  (English Win2k syntax...)

Truls Thirud



Wed, 04 May 2005 15:16:34 GMT  
 problem: decimal separators in gawk on a German windows installation

Quote:

>I have a problem with my version of (GNU) awk and decimal separators
>under windows.

>[.......]
>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?

Try setting LC_ALL=C and LANG=C in your environment, and see if that
makes a difference.  I'd be curious to know your success or not with
this and any other suggestions.

Thanks,

Arnold
--

P.O. Box 354            Home Phone: +972  8 979-0381    Fax: +1 928 569 9018
Nof Ayalon              Cell Phone: +972 51  297-545
D.N. Shimshon 99785     ISRAEL



Fri, 06 May 2005 17:00:33 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. gawk 3.1.1/windows command line args problem

2. Windows: COM Automation problem with german VB localisation

3. Installation problem on Windows

4. VisualAge Beta 2.0 for Windows Installation Problems

5. Problems with installation of system and support files with Labview 5.1 on Windows NT.

6. Installation problem under windows XP

7. Problem with Windows Installation 1.6.2

8. Windows ME Installation Problem - PLEASE HELP!!!

9. PyQt installation problems on windows

10. Installation Problem in Windows

11. BLT installation problem in Windows

12. Installation problem (scotty on windows NT)

 

 
Powered by phpBB® Forum Software