Gawk difficulties

Gawk difficulties

Post by Samuel Druk » Fri, 04 Jun 1993 03:49:14



I've had some difficulties with gawk of late. I'm using the SLS
installed version (as of last Feb) and several mundane uses have been
failing.

Pnews dies with an awk core dump (from the SLS/newspak trn
distribution). The configure for the new GNU patch util fails
similarly (syntax error, line 15: core dump).

OK, I thought, the good people of the FSF have provided source and
there is a later version--I'll try that. I snarfed gawk last night and
tried a rebuild. It built, but failed *all* but one of its self tests.

Anybody else having gawk troubles or have successfully ported it?

Thanks! (and apologies for the waste of bandwidth to those who weren't
interested but read through the message anyway).

--
Samuel Druker                                   uunet!cognex!samuel
Cognex, Corp.                                   +1 617 449 6970 x541
15 Crawford Street
Needham, MA  02146 USA

 
 
 

1. rsh [server] gawk "gawk-program" fails

Hi there,

I'm trying to invoke a gawk command on host B from host A using rsh, like
this:
/usr/bin/rsh server2 /usr/bin/gawk "'{ MY_DATE = strftime(\"%d/%m/%Y\",\$1)
MY_INDEX = index(\$4, \"/\")  TCP_CODE = substr(\$4, 1, (MY_INDEX-1))  if
(!(TCP_CODE==\"NONE\" || TCP_CODE==\"TCP_DENIED\"))  print MY_DATE,
TCP_CODE, \$5, \$7, \$8  }' /var/logs/cache/access.log.0 >
/var/logs/cache/access.log.0.tmp"

When I run this command, here's what happens:
gawk: cmd. line:1: { MY_DATE = strftime("%d/%m/%Y",$1) MY_INDEX = index($4,
"/") TCP_CODE = substr($4, 1, (MY_INDEX-1)) if (!(TCP_CODE=="NONE"
|| TCP_CODE=="TCP_DENIED")) print MY_DATE, TCP_CODE, $5, $7, $8  }
gawk: cmd. line:1:                                              ^ parse
error
gawk: cmd. line:1: { MY_DATE = strftime("%d/%m/%Y",$1) MY_INDEX = index($4,
"/") TCP_CODE = substr($4, 1, (MY_INDEX-1)) if (!(TCP_CODE=="NONE"
|| TCP_CODE=="TCP_DENIED")) print MY_DATE, TCP_CODE, $5, $7, $8  }
gawk: cmd. line:1:
^ parse error
gawk: cmd. line:1: { MY_DATE = strftime("%d/%m/%Y",$1) MY_INDEX = index($4,
"/") TCP_CODE = substr($4, 1, (MY_INDEX-1)) if (!(TCP_CODE=="NONE"
|| TCP_CODE=="TCP_DENIED")) print MY_DATE, TCP_CODE, $5, $7, $8  }
gawk: cmd. line:1:
^ parse error

The first two parse errors seem to be referring to the equals signs between
MY_INDEX and index(), and between TCP_CODE and substr(). The third parse
error doesn't seem to refer to anything in the code, but always appears a
certain amount of characters after the beginning of the command.

The gawk program works when run from a shell script on server2.

I've looked in a few shell books and done a bit of searching, but I'm still
stuck... any pearls of wisdom, anyone?

Thanks in advance,
Guy.

2. mgetty question

3. Gridware difficulties and NFS difficulties (?)

4. OBSD 3.0, XFree86 4.1, truetype fonts ??

5. Is there a gawk version 3.0.2 problem?

6. Server for Nvidia accelertor

7. gawk gone sour

8. Help with Compaq Deskpro XL and Solaris x86? ...so much for pentiums being fast!

9. gawk 3.0.2 announcement

10. compile gawk-2.15.2 ?

11. determing gawk return value

12. Gawk-2.15.6 & gcc-2.70 in ELF, testing

13. why bash script stops at gawk error