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

Re: gawk: bug or feature?



Hello,

> I'm filtering a file using gawk. since there are line that look alike, but
> differ only by two chars, I decided to take this approach:
... 

> my understanding of gawk working:
> 
> get a line from file
> scan pattern in order of appearance and if a match is found, execute action
> until end-of-file

That is correct, but a line is split into fields as soon as it is read from
the file (check in the manpage under the subheading "Fields").

That way you can have conditions such as "$5 > 500".

So what's happening is that the line is split up before gawk gets to the point
where you change FIELDWIDTHS. The new value is then used for the next record.


Without knowing what your input looks like, I can't really make any useful
suggestions about how to parse it.  


HTH

Jiri <jiri@baum.com.au>


Reply to: