ok, I know this came up awhile ago, and I dont want to bring it
up again. However, not enuf disk to keep articles around, and
I forgot the answer:
Question: what syntax do I have to use to get awk to take /bin/sh
variables in a shell script?
Example: given a /bin/sh script, and an awk command in it somewheres,
and i need to pass the var ${fred} to awk, what should
the following line look like?
fred="barney"
wilma=`cat ${file1} | awk '{if($1== fred ){print("match")}}'
^^^^
what I need is how to expand fred_| to get awk to
replace it with the string "barney"
Since this already came up, just email me the answer. I've already
tried ${fred}, $fred, "${fred}" and a couple other combos.
thanks
--gaspo.
BTW, the example is just that, I don't need a different way to solve
the example. just get the vars to awk.
/--------------------------------------------------------------------------
| Scott "gaspo" Gasparian -- System Administrator | _>________ _<________ |
| Dept. Informatik, Eidg. Techn. Hochschule, Zurich |/[][][][][]\/[][][][][]\|
| ETH-Zentrum, CH-8092 Zurich. T# 01-01-254-7205 |`oo------oo'`oo------oo'|
| ..!ethz-inf!gaspar | along the way.In this proud land,you can't forget your|
\--------------------------------------------------------------------------