🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Bill Vaughn Thu, 05 Sep 1985 22:21
Awk bug
#461
Author: Bill Vaughn
Date: Thu, 05 Sep 1985 22:21
51 lines
1808 bytes
A bug in awk which I thought had been fixed seems to have reappeared in
another situation.  It involves the string $0 and how the modification of
individual fields affect it. It seems that the assignment of $0 to a
variable has not been covered by the previous fix. But then, a bare 'print'
statement changes $0 to what one expects it to be!
Check out the following script. (blank lines inserted for readability)

Script started on Thu Sep  5 17:43:58 1985

11> cat /tmp/awks
{$1=""; x[1]=$0; print x[1]}\
{print}\
{y=$0; print y}

12> echo 1 2 3 | awk -f /tmp/awks
1 2 3
 2 3
 2 3

13> cat /tmp/awks1
{$1=""; print}\
{x[1]=$0; print x[1]}\
{y=$0; print y}

14> echo 1 2 3 |awk -f /tmp/awks1
 2 3
 2 3
 2 3

15> cat /tmp/awks2
{$1=""; y=$0; print y}\
{print}\
{x[1]=$0; print x[1]}

16> echo 1 2 3 |awk -f /tmp/awks2
1 2 3
 2 3
 2 3

17> 
script done on Thu Sep  5 17:49:04 1985

Does anybody know whats going on here? If it's relevant, I'm running 4.2bsd
on a 750. Thanks

_________________________________
\         Bill Vaughn           /
 \  Center for Visual Science  /
 /   University of Rochester   \
/   rochester!ur-cvsvax!bill    \
---------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads