Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Aug 1996 13:13:47 BST
From:      Michael Ryan <mike@NetworX.ie>
To:        FreeBSD Support <questions@freebsd.org>
Subject:   Bug in gawk?
Message-ID:  <ECS9608041347A@NetworX.ie>

next in thread | raw e-mail | index | archive | help
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
<mike@NetworX.ie>
---






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ECS9608041347A>