[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
- [bug-gawk] FIELDWIDTHS can miscount the number of fields, Arnold Robbins, 2017/05/20
- Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields, Andrew J. Schorr, 2017/05/21
- Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields, Wolfgang Laun, 2017/05/21
- Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields, Arnold Robbins, 2017/05/21
- Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields, Andrew J. Schorr, 2017/05/21
- Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields,
Andrew J. Schorr <=
- Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields, arnold, 2017/05/21
- Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields, Arnold Robbins, 2017/05/22
- Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields, Nethox, 2017/05/22
- Re: [bug-gawk] FIELDWIDTHS can miscount the number of fields, arnold, 2017/05/22