Quote:
Originally Posted by jlliagre
That should be "-v var=$VARIABLE".
|
Thanks for the reply,
I suppose my description by "-v var=$VARIABLE" was not the best one.
What I meant was: at the command prompt this would be "-v var=x" or
"-v var=y" or "-v var=z" etc, depending on which column I want to be
printed out. I know one could solve this by applying the cut command,
on the trace file e.g.
cut -f3 -d" " FILE
but in this way I would have to know which column in the trace
file corresponds to which variable(x,y or z) that is traced. I
want to have a solution where I directly specify the name of
variable I'm interested in, without constantly being bothered with
the column number where this variable trace is located. Instead
this mapping is written once for all in the script itself, all
I would have to do is to specify the name of variable, I would
like printed out (humans are better with names than with numbers,
we'll leave numbers to computers). So the main problem I face
here is how to tell awk that the string in the variable var should
be used as an index into debug_array to fetch value of the variable
x|y|z from the file, not the literal string "var". I have tried this:
print debug_array[$var]
but it doesn't work as I would like it to work.