|
From: | Karl Smith |
Subject: | [bug-gawk] gawk 4.0 bug when getline is in BEGIN |
Date: | Tue, 20 Mar 2012 23:00:40 +1100 |
BUG : when getline is in the BEGIN block it reads two lines instead of one as the attached program demonstrates gawk –f p2.awk tmpgb2.txt BEGIN{ FS="," getline } { printf "NR=%s :%s:\n",NR,$0 } --- The output is below and the second line of the input file is not printed NR=1 :IJK,CUKR1,CU1,Pct Diff from Cmp,Grade Bin: NR=3 :13668,1081.556760,621.300000,0.740796,10: NR=4 :15158,1090.756667,651.980831,0.672989,10: NR=5 :15239,1042.806452,402.285714,1.592204,10: --- IF getline is commented out then the output is: NR=0 :: NR=1 :IJK,CUKR1,CU1,Pct Diff from Cmp,Grade Bin: NR=2 :40889,19.000000,298.500000,-0.936348,0: NR=3 :13668,1081.556760,621.300000,0.740796,10: NR=4 :15158,1090.756667,651.980831,0.672989,10: NR=5 :15239,1042.806452,402.285714,1.592204,10: --- The input file is shown below IJK,CUKR1,CU1,Pct Diff from Cmp,Grade Bin 40889,19.000000,298.500000,-0.936348,0 13668,1081.556760,621.300000,0.740796,10 15158,1090.756667,651.980831,0.672989,10 15239,1042.806452,402.285714,1.592204,10 --- gawk version details are > gawk --version GNU Awk 4.0.0 Copyright (C) 1989, 1991-2011 Free Software Foundation. --- My operating system Windows 7 Home Premium Ver 6.1 Build 7601 Service Pack 1 Regards, Karl Karl Smith |
p2.awk
Description: Binary data
tmpgb2.txt
Description: Text document
cygcheck.out
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |