4.2 awk difference

Dick Dunn rcd at opus.UUCP
Tue Jun 12 10:29:32 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.
>...
>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.

The documentation isn't at all unclear.  See the cover page of the awk
document in Vol 2A - it illustrates with:
	{$1 = log($1); print}
which, it states, "replaces the first field of each line by its algorithm".

The 4.2 behavior is definitely a bug which needs fixing.
-- 
Dick Dunn	{hao,ucbvax,allegra}!nbires!rcd		(303)444-5710 x3086
	...Cerebus for dictator!



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