Hi Tobias,
Sorry, couldn't reply any sooner.
You can pass the vars into nawk / gawk from within a shell
wrapper something like this:
var1="word" # or var1=$1 when passed in by call to
# the shell script from command line
Then, inside nawk it is used like this '"$var1"' where
needed. The quotes sometimes need to be reversed to
work for both text and numeric data. (I can never get
it right the first time it seems!)
Sometimes it helps if you build shell pipelines made up
of shell commands, filters like sort, etc., awk scripts,
and even sed scripts to manipulate data.
You may be able to pipe your shell array out of the
command or application that created it and into an awk
script, process through awk, and pipe out into another
command or even stdout. It depends if it's on-the-fly
processing or not.
The output from your awk script can thus be piped into
another command, captured in a shell variable, or displayed
on stdout.
Structure like this:
# shell script wrapper
var1="one"
var2="two"
<command that generates data> |
nawk '
{ ... do something with vars '"$var1"' .... '"$var2"' }
END{ print .... }' | < pipe, redirect, etc. here > ...
You could possibly pipe in the array, manipulate the vars,
and pipe out the results all in one pipeline.
The example that Russ gave sets the results of the awk
script to a var named TMP, then goes from there when
focus is again back in the shell. Several ways to do
things- just need to experiment with the various tools.
This may get you going in a positive direction!
Jesse
flogrr
flogr@yahoo.com