[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gawk 3.1.3 and the floating point: is it a comma now?!?!?
From: |
raffaele di stefano |
Subject: |
gawk 3.1.3 and the floating point: is it a comma now?!?!? |
Date: |
Thu, 9 Sep 2004 11:31:28 +0200 |
User-agent: |
KMail/1.5.4 |
Hallo
I'm not sure this is a bug, but I can't find the proper option to
switch from the default.
I refer to GNU Awk 3.1.3
that comes with SuSE Linux 9.1 (and that have
identical bug also in the gawk that comes with 9.0)
I have a file (Stations_MasterList_v0.5.dat) set as follow:
0 dgi 9.60668 40.31802 0.3540
0 dgiz 9.60668 40.31802 0.3540
1 fog 15.5513 41.4500 0.0000
2 ovo 14.3967 40.8275 0.5840
I need to manipulate it with printf as follow:
cut -c5-39 Stations_MasterList_v0.5.dat |\
gawk '{printf "%4i%5s%10.4f%10.4f%10.4f\n", NR,$1,$2,$3,$4,$5}'
I was expcting an output like this
1 dgi 9.6067 40.3180 0.3540
2 dgiz 9.6067 40.3180 0.3540
3 fog 15.5513 41.4500 0.0000
4 ovo 14.3967 40.8275 0.5840
While I get:
1 dgi 9,0000 40,0000 0,0000
2 dgiz 9,0000 40,0000 0,0000
3 fog 15,0000 41,0000 0,0000
4 ovo 14,0000 40,0000 0,0000
I found a solution that opens the question!
cut -c5-39 Stations_MasterList_v0.5.dat | sed "s/\./\,/g" | \
gawk '{printf "%4i%5s%10.4f%10.4f%10.4f\n", NR,$1,$2,$3,$4,$5}' | \
sed "s/\,/\./g
That's to say that awk doesn't read floating points but floating ...
commas ... And this is absolutely new and indeed a problem for me.
Final note: my SuSE is in italian. But this has never affected awk
in mathematical computation before!!
Help!
raffaele
--
-----------------------------------------
INGV - Istituto Nazionale di Geofisica
e Vulcanologia
Via di Vigna Murata
00143, Roma
Tel: ++39 0651860306
Fax: ++39 0651860507
e-mail: address@hidden
-----------------------------------------
- gawk 3.1.3 and the floating point: is it a comma now?!?!?,
raffaele di stefano <=