GAWK Incorrect Data Display

Jason McGee goodmis@hotmail.com
Sat Dec 19 23:51:15 GMT 2020


Input Data
SP 2183197 SELL  0.01 3686.3
SP 2183197 SELL  0.01 3686.3 3680.0

I’m adding a 0 at the end,  if NF == 5


CORRECT
C:\cygwin64\home\trading_scripts>gawk -f PROCESS_INGOT.awk ingot.txt
"SP", 2183197,"SELL", 0.01, 3686.3, 0
"SP", 2183197,"SELL", 0.01, 3686.3, 3680.0


INCORRECT
gawk -f PROCESS_INGOT.awk ingot.txt
, 0", 2183197,"SELL", 0.01, 3686.3
"SP", 2183197,"SELL", 0.01, 3686.3, 3680.0

For some reason the last variable is transferred to the 1st position.


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

From: Jason McGee<mailto:goodmis@hotmail.com>
Sent: Saturday, December 19, 2020 6:34 PM
To: cygwin@cygwin.com<mailto:cygwin@cygwin.com>
Subject: GAWK Incorrect Data Display

I confirmed there is not a problem with my code by comparing Cygwin against Gawk for Windows.

sp_array[++ sp_count] = d_quote "SP" d_quote ", " ticket "," d_quote type ", " volume ", " price ", " 0

I’m reading a file and writing the data to an array.

I’ve tried multiple variations are the problem is certainly in the Cygwin code.

The output is messed up if I have more than 7 variables.

Thanks

cygwin
$ gawk -f PROCESS_INGOT.awk ingot.txt
, 0                    01, 3686.3
                     0.01, 3686.3, 3680.0

Gawk for Windows
C:\cygwin64\home\trading_scripts>gawk -f PROCESS_INGOT.awk ingot.txt
"SP", 2183197,"SELL, 0.01, 3686.3, 0
"SP", 2183197,"SELL, 0.01, 3686.3, 3680.0


Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10




More information about the Cygwin mailing list