environmental vars in nawk
Richard Karasik
richard at octel.UUCP
Tue Nov 20 13:10:47 AEST 1990
In article <1990Nov15.150642.28752 at cid.aes.doe.CA> afsijsf at cidsv01.cid.aes.doe.CA () writes:
>
> How do you reference an environmental variable (which
>happens to be a pathname) inside a nawk script? eg:
>
>setenv CMCARC=/a/b/c
>
>The awk script could be like this:
>
>BEGIN { aa = $CMCARC
> etc...
My email bounced -so here..
use the ARGV variables and include
environment variable on the command line to invoke
nawk
ie:
nawk -f foobar $CMCARC ....
in this case ARGV[0] is awk, ARGV[1] is $CMARC.
since command lines expand, you should get what you want.
ie your first awk line should look like
BEGIN { aa = ARGV[1]
....
Dont forget to reset ARGV [2] =""
or you'll end up interpreting $CMCARC as a file to be read in.
Richard
More information about the Comp.unix.shell
mailing list