Xref: utzoo comp.unix.questions:19258 gnu.misc.discuss:750 Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions,gnu.misc.discuss Subject: Re: Passing variables to gawk Message-ID: <5138@kappl.cs.vu.nl> Date: 19 Jan 90 05:01:01 GMT References: Reply-To: maart@cs.vu.nl (Maarten Litmaath) Distribution: comp, gnu Organization: VU Informatika, Amsterdam, the Netherlands Lines: 25 In article , mikemc@mustang.ncr-fc.FtCollins.NCR.com (Mike McManus) writes: \I want to pass variables to a gawk program via the command line. According to \the man page, all you need do is call gawk with = instead of file \names: [...] [and it doesn't work] Known disgusting bug: the variables aren't set until the FIRST LINE HAS BEEN READ. Workaround: NR > 1 { # do something with lines > 1 next; } NR == 1 { # do something with command line variables # do something with line 1 } (In this example either the `next;' statement or the `NR == 1' test can be left out.) -- What do the following have in common: access(2), SysV echo, O_NONDELAY? | Maarten Litmaath @ VU Amsterdam: maart@cs.vu.nl, uunet!mcsun!botter!maart