problem with awk under OSF/1 3.0

From: Elizabeth I. Sewell <msdc!osfmgt_at_uunet.uu.net>
Date: Mon, 9 Jan 95 15:07:55 EST

We recently upgraded our Alpha 4000/610 from OSF/1 2.0 to version 3.0.
Apparently there is a "feature/bug" in awk under OSF/1 3.0 that occurs
under the following condition:

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.

The good news is that I can change the input to avoid the problem. The
bad news is that *many* of our jobs use awk to process data for reports, etc.
This is going to be a huge task.

Is this a known bug for which a patch might be available? Is this a feature
of the new awk that I'm just going to have to deal with? Any information
would be much appreciated. I apologize if this is the incorrect forum
for this question.

Thanks for your input.

Beth Sewell (osfmgt_at_msdc.com)
Medical Systems Development Corporation Atlanta, GA
Received on Mon Jan 09 1995 - 16:14:11 NZDT

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