Path: utzoo!attcan!utgpu!watmath!att!rutgers!ucsd!usc!samsung!uunet!littlei!omepd!merlyn From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions Subject: Re: Import variables in to awk. Message-ID: <5201@omepd.UUCP> Date: 16 Nov 89 01:01:26 GMT References: <10531@thorin.cs.unc.edu> Sender: news@omepd.UUCP Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Distribution: na Organization: Stonehenge; netaccess via Intel, Hillsboro, Oregon, USA Lines: 26 In-reply-to: warner@unc.cs.unc.edu (Byron Warner) In article <10531@thorin.cs.unc.edu>, warner@unc (Byron Warner) writes: | My questions is how do you import csh variables into an awk script. | for example if I have a file called foo, which contains: | { | print import,$0 | } | | and I issue the command | awk -F: -f foo /etc/passwd import='hello ^ missing quote, perhaps? | why do I get just a list of logins? The order of command-line options is significant: % awk -F: -f foo import='hello' /etc/passwd yields the result you want. Also note that these variables are not available in the "BEGIN" action (unless something happened after the V7 version of awk). Just another UNIX old-timer, -- /== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\ | on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/