Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uwm.edu!vacs.uwp.wisc.edu!datta From: datta@vacs.uwp.wisc.edu (David Datta) Newsgroups: comp.unix.misc Subject: Re: passing arguments to awk scripts (Thanks & here is how) Message-ID: <10110@uwm.edu> Date: 10 Mar 91 20:40:07 GMT References: <1991Mar9.212943.1961@casbah.acns.nwu.edu> <10094@uwm.edu> <1991Mar10.082124.9416@convex.com> Sender: news@uwm.edu Reply-To: datta@vacs.uwp.wisc.edu (David Datta) Distribution: na Organization: University of Wisconsin - Parkside Lines: 40 In tchrist@convex.COM (Tom Christiansen) sort-of writes: >From the keyboard of datta@vacs.uwp.wisc.edu (David Datta): >:Can it be done? Is there a way I can address a >:command line argument within the script? > Actually, gawk and nawk will also let you get at them, although > awk won't. Check your man page >--tom I started with the man pages they make NO MENTION of parameter passing BUT: From: dwn@swbatl.sbc.com (David Neill) If you want to pass variables to awk, it works like so: awk ' { script stuff using VAR1 and VAR2 } ' VAR1=something VAR2=somethingelse filenames THANKS Dave! For example, with the file "script" -----------TOF { print var1 } EOF----------- calling awk -f script var1="hi" will work. -- -Dave datta@vacs.uwp.edu [....uwm!uwpvacs!datta] The moon goes around in orbit. It's the only place the moon does go. The moon only makes left turns. To get anywhere else you have to get off. WANT TO GET OFF?