Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mcsun!hp4nl!star.cs.vu.nl!maart
From: maart@cs.vu.nl (Maarten Litmaath)
Newsgroups: comp.unix.xenix
Subject: Re: awk
Message-ID: <3426@solo8.cs.vu.nl>
Date: 29 Sep 89 02:52:08 GMT
References: <218001@neabbs.UUCP>
Organization: V.U. Informatica, Amsterdam, the Netherlands
Lines: 17

richard@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@cs.vu.nl, mcvax!botter!maart