awk

Maarten Litmaath maart at cs.vu.nl
Fri Sep 29 12:52:08 AEST 1989


richard at neabbs.UUCP (RICHARD RONTELTAP) writes:
\...
\awk 'BEGIN {print x}' x=foo
\should print 'foo' and start reading stdin, but it prints an empty
\line and terminates.

Known bug: the variable is only set AFTER the first input line has been
read. :-(
Work-around:

	(echo ''; cat) | awk 'NR == 1 {print x}' x=foo -

Don't forget to add the `-' (for stdin), else you'll step into another
bug... :-(
-- 
 `I AM NEW HEAR AMD I WANT TO INKRIMENT A |Maarten Litmaath @ VU Amsterdam:
 VURIABLE BY 1 (OONE) IN "c"'  (Tom Neff) |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.xenix mailing list