Richard Mitchell 1026 (mitchell@aol12.wff.nasa.gov) wrote:
: nawks usage statement is:
: Usage: nawk [-f programfile | 'program'] [-Ffieldsep] [-v var=value] [files]
: ^^^^^^^^^ ^^^^^^^^^^^^
: which would indicate that the offered solution would work, but it
: doesn't (at least not here). The correct format is:
: nawk -v var="foo" 'program' [files]
: Had I read the manpage (or used common sense) this would have
: been obvious. The downside to all of this, is that R3 and R4
: and quite incompatible on this subject. R3 requires the
: var="foo" to be AFTER the program, while R4 requires it (and the -v)
: to be BEFORE the program. Oh well, so it goes.
If you need compatibility, then something like this might work for
you:
nawk 'prog' var=foo /dev/null [files]
Then use an if statement in the END clause to check for file
/dev/null, if you have to make a distinction between the fake file
and the user files.
You could also provide a shell script as a wrapper around the nawk
program to hide the /dev/null file from your users.
Mike
ANOTHER way would be to process the command line yourself. You
can find it in the ARGV array, etc. You might want to avoid equal
signs in that case.
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:08:18 CDT