SUMMARY: problem with awk under OSF/1 3.0

From: Elizabeth I. Sewell <msdc!osfmgt_at_uunet.uu.net>
Date: Wed, 18 Jan 95 12:10:41 EST

Apologies for the late summary...

My original question dealt with a bug in awk under OSF/1 version 3.0:

>Suppose I'm printing the fourth field on a line ($4) (assuming each field
>is colon delimited) with the following awk script:
>
> BEGIN \
> {
> FS = ":"
> }
> {
> printf " %s\n", $4
> }
>
>The following input yields unexpected results:
>
> a1:a2:a30:a4
> b1:b2:b3:
>
>The output looks like:
>
> a4
> a4
>
>I expect the second line to be blank. Instead it picks up
>$4 from the previous line. When I print NF for the second line, it
>prints "4" (i.e. it thinks it has four fields). The other *very* strange
>fact is that if the fields on the first line are all of the same length
>(e.g. $3 == a3 instead of a30), the problem does not occur.
>Furthermore, if I delimit the fourth field on the second line so that it looks
>like: b1:b2:b3:: the problem goes away. Finally, if I use 'oawk' from
> ^^^
>the OSFOBSOLETE300 subset, the problem does not occur.
>

In general the consensus is that this is in fact a bug and that most folks
have had better success with gawk (gnu awk). Tom De Pauw reccommended
using mawk if it was available.

Dr. Tom Blinn with DEC's UNIX Software Group replied with the following:

>Beth, I checked your question with one of the most knowledgeable awk wizards
>I know (the guy who wrote most of the documentation in our manuals) and he
>says it's definitely a bug.
>
>You should report this to Digital's customer support center as a VERY HIGH
>priority problem. Let them tell you whether there's a patch or work-around
>(even though you already found a work-around). If you don't report it as a
>bug, it may not get fixed. I'm pretty sure it's not fixed in V3.2 unless it
>is caused by a bug in one of the shared libraries that got fixed. If it's a
>main-line awk problem, it didn't get fixed.
>
>I'd recommend you replace awk on your system with either oawk or gawk for
>the time being. You shouldn't need to change your scripts. gawk (Gnu awk)
>is on the OS distribution, and works correctly in almost all cases.
>
>Tom
 
I will report this bug and in the meantime will switch to gawk.

Many many thanks to:
Thomas Heistracher (uunet!dbio10.bio.sbg.ac_at_!heistr)
Joe Provo (jprovo_at_ultra.net)
Craig Hagan (uunet!oec.com!hagan)
Steven W. Orr (steveo_at_uniprise.com)
Tom De Pauw (tom_at_finning.ca)
and especially Dr. Tom Blinn (tpb_at_zk3.dec.dom)

Beth Sewell (osfmgt_at_msdc.com)
Medical Systems Development Corporation Atlanta, GA
Received on Wed Jan 18 1995 - 14:17:41 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:45 NZDT