Problem with Gawk

From: Elizabeth I. Sewell <msdc!beth_at_uunet.uu.net>
Date: Wed, 29 Mar 95 10:17:24 EST

Hi folks!

I wrote in January describing a bug in awk under OSF/1 version 3.0.
In certain circumstances, awk didn't give correct results. You were
most helpful; confirming that it was in fact a bug and suggesting
gawk (or mawk).

I've just recently been able to get back to this project and unfortunately
I've also discovered some weird behavior in gawk. I'm assuming this is
a bug but I'd be open to any explanations to the contrary. The version
I'm using is 2.14, patchlevel 1.

Under the following set of circumstances, gawk simply returns a
"Usage" message:

Example:

    /bin/ps -e -o pid,command | gawk '{ if ($2 == "rlogind") print $1 }'

This example won't run on our Alpha 4000/610. After trying many examples
designed to specifically diagnose the problem, I think the problem occurs only
when all of the following are true: (a) you are using the "gawk 'script'"
syntax (i.e. not using the -f option), (b) the only statement in the script
is an action statement with no pattern statement, (c) there is an "=" sign
in the action statement.

    /bin/ps -e -o pid,command | gawk '{ if ($2 > 0) print $1 }'

works (no "=" sign).

    /bin/ps -e -o pid,command | gawk '{ if ($2 == "rlogind") print $1 } END { print "ending script." '

works (the action statement is not the only one in the script).

Although this seems like quite a narrow set of circumstances, it's amazing
how many occasions we have to use processing like this. As a matter of fact,
this example is straight out of DEC's startup script for the networking
programs (rc3.d/S19nfs).

Does anyone know if this is a known problem? If so, is there a patch?
Is this the latest version of gawk? This is the version that was installed
with the OSF/1 3.2 OS.

Thanks for your input.

Beth Sewell (beth_at_msdc.com)
Medical Systems Development Corporation Atlanta, GA
Received on Wed Mar 29 1995 - 22:12:01 NZST

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