traditional awk: lazy splitting of $0?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a question about traditional awk (that came up while working on
Paolo's pending autotest patch), regarding this note in autoconf.texi:

     Traditional Awk has a limit of 99 fields in a record.  You may be
     able to circumvent this problem by using `split'.

Can I rely on the fact that splitting of $0 is done lazily?  I.e.:
  perl -e 'print "x "x100;' | awk '{print $0}'

works with Solaris 2.6 awk, but
  perl -e 'print "x "x100;' | awk '{print $1}'

fails with
| awk: record `x x x x x x x x x x ...' has too many fields
|  record number 1

but I would like to know whether we can rely on awk to not try the
splitting if $i, i>0, is never referenced.  If yes, then I suppose we
can also simplify the config headers and config files awk scripts by not
setting FS at all.  OTOH, we might still want to set it as a safeguard
measure against later changes that may happen to inadvertently introduce
splitting again.

Thanks,
Ralf


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux