[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: awk: $0 != $ 0
From: |
Paul Eggert |
Subject: |
Re: awk: $0 != $ 0 |
Date: |
Sun, 26 Nov 2006 10:16:08 -0800 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Ralf Wildenhues <address@hidden> writes:
> Well, seems '$ 0' isn't quite the same as '$0', at least with Solaris
> /bin/awk:
Yes, I reproduced that issue with Solaris 10. My guess (I haven't
looked at the Solaris source) is that plain 'print' prints the
original input line, not $0, and that the Sun maintainers put in a
'can't set $0' diagnostic so that users were warned about the problem,
but they didn't catch all the cases so the warning isn't always made.
> The following one is the most interesting: with one Solaris 5.8 host,
> I get an infinite loop and no output, on another 5.8 host I get:
>
> $ awk '{ $ 0 = $ 0 "x" $ 0 ; print }' < dummy.in
> @ac_Dummy_001@
> @f1@
I get the latter, on both Solaris 8 and 10. With the infinite-loop
host, has Sun patch 111111-06 (dated 2006-04-10) been installed? It
seems relevant.
As you mentioned, the workaround is easy. For Awk code that needs to
modify the entire input line, I typically do this:
line = $0
and then modify and print 'line' rather than trying to set '$0'. This
is more portable, and the code is saner anyway.
- Re: config files substitution with awk, (continued)
- Re: config files substitution with awk, Paul Eggert, 2006/11/21
- Re: config files substitution with awk, Paul Eggert, 2006/11/21
- Re: config files substitution with awk, Ralf Wildenhues, 2006/11/21
- Message not available
- Re: config files substitution with awk, Paul Eggert, 2006/11/21
- Re: config files substitution with awk, Ralf Wildenhues, 2006/11/24
- Re: config files substitution with awk, Paul Eggert, 2006/11/26
- Re: config files substitution with awk, Ralf Wildenhues, 2006/11/27
- Re: config files substitution with awk, Ralf Wildenhues, 2006/11/28
- Re: config files substitution with awk, Paul Eggert, 2006/11/27
- awk: $0 != $ 0 (was: config files substitution with awk), Ralf Wildenhues, 2006/11/24
- Re: awk: $0 != $ 0,
Paul Eggert <=