Xref: utzoo comp.unix.questions:19138 gnu.misc.discuss:735 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!boulder!ccncsu!ncr-fc!mikemc From: mikemc@mustang.ncr-fc.FtCollins.NCR.com (Mike McManus) Newsgroups: comp.unix.questions,gnu.misc.discuss Subject: Passing variables to gawk Message-ID: Date: 17 Jan 90 21:12:46 GMT Sender: news@ncr-fc.FtCollins.NCR.COM Distribution: comp, gnu Organization: NCR Microelectronic Products, Ft. Collins, CO Lines: 23 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: gawk -f foo.awk a=1 b=2 c=3 infile > outfile and the variables a,b,c will be free to use in foo.awk (the gawk script), and will be assigned the values 1,2,3. I can't seem to get this to work! When I print the value of the variables inside a BEGIN{} block in foo.awk, they are all set to 0. Anybody have any experience with this that they'd like to share? Thanks! -- Disclaimer: All spelling and/or grammer in this document are guaranteed to be correct; any exseptions is the is wurk uv intter-net deemuns. Mike McManus (mikemc@ncr-fc.FtCollins.ncr.com) NCR Microelectronics 2001 Danfield Ct. ncr-fc!mikemc@ncr-sd.sandiego.ncr.com, or Ft. Collins, Colorado ncr-fc!mikemc@ccncsu.colostate.edu, or (303) 223-5100 Ext. 360 uunet!ncrlnk!ncr-sd!ncr-fc!garage!mikemc