From owner-freebsd-questions Sun Aug 4 07:20:53 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id HAA05890 for questions-outgoing; Sun, 4 Aug 1996 07:20:53 -0700 (PDT) Received: from sam.networx.ie (dublin-ts5-128.indigo.ie [194.125.133.128]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id HAA05885 for ; Sun, 4 Aug 1996 07:20:47 -0700 (PDT) Received: from mip1.networx.ie (mip1.networx.ie [194.9.12.1]) by sam.networx.ie (8.6.12/8.6.12) with SMTP id NAA10650 for ; Sun, 4 Aug 1996 13:22:06 +0100 X-Organisation: I.T. NetworX Ltd X-Business: Network Consultancy and Training X-Address: 67 Merrion Square, Dublin 2, Ireland X-Voice: +353-1-676-8866 X-Fax: +353-1-676-8868 Received: from mike.networx.ie by mip1.networx.ie Date: Sun, 4 Aug 1996 13:13:47 BST From: Michael Ryan Reply-To: mike@NetworX.ie Subject: Bug in gawk? To: FreeBSD Support Message-Id: Priority: Normal Mime-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=US-ASCII Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Am I being unreasonable in expecting the following awk program to work? Note that the 2nd version does work. System is FreeBSD 2.1R (Walnut Creek CD-ROM) $ awk -W version Gnu Awk (gawk) 2.15, patchlevel 5 Version 1: does not work ------------------------------------------------------- $ cat > awkprog { gsub(/a/, "A", substr($0, 2)) print } ^D $ awk -f awkprog infile awk: awkprog:2: (FILENAME=infile FNR=1) fatal: internal error line 1150, file: / usr/src/gnu/usr.bin/awk/eval.c $ cat infile Mary had a little lamb, whose fleece was white as snow, And everywhere that Mary went, the lamb was sure to go. $ Version 2: does work ------------------------------------------------------- $ cat > awkprog { line = substr($0, 2) gsub(/a/, "a", line) print line } ^D $ awk -f awkprog infile Ary hAd A little lAmb, hose fleece wAs white As snow, nd everywhere thAt MAry went, he lAmb wAs sure to go. $ Any ideas? Mike ---