Thread View: comp.unix.shell
3 messages
3 total messages
Started by afsijsf
Thu, 15 Nov 1990 15:06
environmental vars in nawk
Author: afsijsf
Date: Thu, 15 Nov 1990 15:06
Date: Thu, 15 Nov 1990 15:06
13 lines
779 bytes
779 bytes
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
Re: environmental vars in nawk
Author: Richard Karasik
Date: Tue, 20 Nov 1990 02:10
Date: Tue, 20 Nov 1990 02:10
31 lines
1218 bytes
1218 bytes
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
Re: environmental vars in nawk
Author: Richard Karasik
Date: Tue, 20 Nov 1990 02:20
Date: Tue, 20 Nov 1990 02:20
3 lines
494 bytes
494 bytes
Whoops that should have been set argv[1] ="" Richard
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads