4.2 awk difference

z at rocksvax.UUCP z at rocksvax.UUCP
Fri Jun 8 09:35:18 AEST 1984


DESCRIPTION:
	4.2 awk fails to modify $0 when one of $1, $2, ... is modified.  The awk
distributed with 4.1 handles the case below as documented.

REPEAT BY:
	In the file awk1:
	{ $1 = $2 ; print $1 , $0 }

	Then run:
echo a b | awk -f awk1

	Output will be:
b a b
	in 4.1 was:
b b b

POSSIBLE SOLUTION:
	The action of 'print $0' can be performed by 'for (i=1;i<=NF;i++)
printf "%s " $i;'.  Thus one still has the full capability of the old awk.
Since the documentation is slightly unclear about $0 when changed as a
side-effect it might be better to just delete this feature from awk.  In other
words simply change the documentation.
-- 
//Z\\
James M. Ziobro
Ziobro.Henr at Xerox.ARPA
{rochester,amd70,sunybcs}!rocksvax!z



More information about the Comp.bugs.4bsd.ucb-fixes mailing list