From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96075318306726.tru64-unix-managers.marc@archive.invalid> From: msdc!beth () uunet ! uu ! net (Elizabeth I ! Sewell) Date: Wed, 29 Mar 1995 10:17:24 +0000 To: tru64-unix-managers Subject: Problem with Gawk X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96075318306726 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@msdc.com) Medical Systems Development Corporation Atlanta, GA