bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields


From: Andrew J. Schorr
Subject: Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields
Date: Sun, 21 May 2017 15:58:52 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Sun, May 21, 2017 at 03:46:52PM -0400, Andrew J. Schorr wrote:
> > Q2. Given FIELDWIDTHS = "2 3 4" and input data "aab", should $2 have a
> >     value?
> >     A. No - we're expecting three characters and they weren't all there
> >     B. Yes - something was there, make it available
> > 
> > A2. Gawk currently says "yes".  Arnold isn't sure what's right here.
> >     Input is welcome.
> 
> I agree with current behavior (B).

To elaborate on this: the code can use length($2) to test for this. In many
usage cases, the program will know that it's truly a fixed-width record.
For variable-length records, the code will need to take care to check these
issues.

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]