afsijsf@cidsv01.cid.aes.doe.CA (11/15/90)
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...
}
Please send e-mail reply.. thanks
richard@octel.UUCP (Richard Karasik) (11/20/90)
In article <1990Nov15.150642.28752@cid.aes.doe.CA> afsijsf@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
richard@octel.UUCP (Richard Karasik) (11/20/90)
Whoops that should have been set argv[1] ="" Richard