Date: Fri, 7 Mar 1997 09:20:40 +1100 (EST) From: "Daniel O'Callaghan" <danny@panda.hilink.com.au> To: John Utz <spaz@u.washington.edu> Cc: hackers@FreeBSD.ORG Subject: Re: awk bug? in 2.2 BETA? Message-ID: <Pine.BSF.3.91.970307091829.2758B-100000@panda.hilink.com.au> In-Reply-To: <Pine.OSF.3.95.970306101744.11587E-100000@becker1.u.washington.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 6 Mar 1997, John Utz wrote: > Hello; > > could an awk literate person comment on this ? The behavior on the > follwing line of code appears to be awk version related. a linux guy > running 3.0 patch 0 gets a correct answer, my freebsd 2.2 BETA awk 2.15p5 > does not. > > mira: {60} cat fd1.dat | awk 'BEGIN { FS = " " }; END { printf "rf= %g; cf > = %g\n;", NR, NF }' > > rf= 9801; cf = 0; > > cf should be 3! I'm not sure but wouldn't cf report the number of colums in the END record, i.e. 0. Try the code below. > mira: {60} cat fd1.dat | \ awk 'BEGIN { FS = " " }; { if ( cf > c ){ c = cf }}; END { printf "rf= %g; cf = %g\n;", NR, NF }' Danny
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.970307091829.2758B-100000>