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 14:58:55 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Sun, May 21, 2017 at 09:52:49PM +0300, Arnold Robbins wrote:
> You ask tough questions.

:-) Sorry to be a pain.

> To me it seems obvious that if all the
> requested data isn't there then the number of fields should be smaller,
> allowing a check against what's expected to make it possible to weed
> out bad data.

I agree with you, but it is a change in behavior. I think it's probably
safe to do this, but we should document how this stuff works.

> It opens up the question of what if there is short data for an
> individual field - FIELDWIDTHS says field 2 is 5 characters but only
> three are there.

Yes. Wolfgang's example is on point.

> None of this is well defined in the documentation, nor, obviously
> was it well thought out to start with. :-(
> 
> I have written the code to handle the suggested '*' at the end to
> mean "the rest of the record", which in and of itself is probably
> a good idea.

Agreed.

> I guess I need to define what happens in these corner cases and
> put it up for discussion here and then go with whatever seems to
> make the most sense after the discussion is done. Sigh.

I don't expect much disagreement over this, but one never knows. I think
we should state clearly what we are doing, and then we should be OK.
It seems clear that nobody has yet written code with FIELDWIDTHS that
depends on the subtle NF behavior that you are discussing, so I doubt
we will break anything.

Regards,
Andy



reply via email to

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