Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!rutgers!bellcore!texbell!vector!attctc!ozdaltx!root
From: root@ozdaltx.UUCP (root)
Newsgroups: comp.unix.xenix
Subject: Re: awk
Message-ID: <5671@ozdaltx.UUCP>
Date: 30 Sep 89 00:43:44 GMT
References: <218001@neabbs.UUCP>
Organization: OZ BBS - Dallas, TX
Lines: 27

In article <218001@neabbs.UUCP>, richard@neabbs.UUCP (RICHARD RONTELTAP) writes:
> Help! I need to finish an AWK program yesterday, but can't get it to
> pass parameters.
>  
> For example:
> awk 'BEGIN {print x}' x=foo
> should print 'foo' and start reading stdin, but it prints an empty
> line and terminates.
>  

Remember that awk works on a record by record basis, each
record terminated by a newline unless told otherwise.

In your example, it probably would be as effective to do
something like:

   (echo $x; awk '{...command list .....}') 

The parenthesis keep the shell from "seeing" the two
commands as being different and treats them as one command.

One of the best books detailing awk is called the UNIX
PROGRAMMING ENVIROMENT by Kerningon & Pike.  Pretty well
explains everything you'd want to know.

good luck....
         Scotty