awk

root root at ozdaltx.UUCP
Sat Sep 30 10:43:44 AEST 1989


In article <218001 at neabbs.UUCP>, richard at 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



More information about the Comp.unix.xenix mailing list