Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!lll-crg!styx!nike!cad!ucbvax!sdcsvax!sdchem!jwp From: jwp@sdchem.UUCP (John Pierce) Newsgroups: net.unix Subject: Re: passing command line arguments to awk Message-ID: <233@sdchema.sdchem.UUCP> Date: Tue, 3-Jun-86 20:19:59 EDT Article-I.D.: sdchema.233 Posted: Tue Jun 3 20:19:59 1986 Date-Received: Thu, 5-Jun-86 19:39:35 EDT References: <198@comp.lancs.ac.uk> <1261@utcs.uucp> <27@sunybcs.UUCP> Reply-To: jwp@sdchema.UUCP (John Pierce) Distribution: net Organization: Chemistry Dept, UC San Diego Lines: 27 Keywords: awk Somebody: > >awk -f awkfile arg1=$1 arg2=$2 inputfile > > > >will assign $1 to arg1, and $2 to arg2, inside the body of the awk program. > >It is not possible to assign variable values in this manner to variables > >that are used inside an action associated with the BEGIN pattern. This is correct. Somebody else: > There is a much more general method to use. If you put the awk code inside of > the shell script [and use the shell to expand args]... Also correct, but I'm not sure it's more "general", or useful. It must get very interesting typing five hundred lines of awk script into a file the shell is going to parse first.... There were references to new versions of awk that appear to have considerably more capabilities than the one distributed with BSD and Sys V (or at least the version of Sys V on the campus 3B20s). Can anybody tell me where they come from, and whether or not they're available? [Of course, I can probably guess the answer to both of those.] -- John Pierce Chemistry Dept, B-032 jwp%chem@sdcsvax.ucsd.edu University of California, San Diego sdcsvax!sdchem!jwp La Jolla, CA 92093 +1 619 452 4016