Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site rocksvax.UUCP Path: utzoo!linus!vaxine!wjh12!genrad!grkermit!masscomp!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!floyd!cmcl2!seismo!rochester!rocksvax!z From: z@rocksvax.UUCP Newsgroups: net.bugs.4bsd Subject: 4.2 awk difference Message-ID: <502@rocksvax.UUCP> Date: Thu, 7-Jun-84 19:35:18 EDT Article-I.D.: rocksvax.502 Posted: Thu Jun 7 19:35:18 1984 Date-Received: Wed, 13-Jun-84 05:03:41 EDT Organization: Xerox Lines: 27 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@Xerox.ARPA {rochester,amd70,sunybcs}!rocksvax!z