hi everyone;
i want to take a shell variable and pass it to the -f (external file) option of awk.
i have tried a couple of ways and neither works.
btw, the reason i'm trying to achieve this is because for every input file there is an associated awk file (e.g IDA1.xml is associated to IDA1.sub etc).
any help is appreciate.
thanks in advance.
daula
i want to take a shell variable and pass it to the -f (external file) option of awk.
i have tried a couple of ways and neither works.
btw, the reason i'm trying to achieve this is because for every input file there is an associated awk file (e.g IDA1.xml is associated to IDA1.sub etc).
any help is appreciate.
thanks in advance.
daula
Code:
TALLY="$1"
OUT_FILE="$4"
FORM="$2"
AXIS="$3"
.
.
.
function func ()
{
echo `expr substr $TALLY 4 1`
}
my_id=`eval func`
sub="IDA$my_id.sub"
1)
awk -v FORMAT="$FORM" -v xAXIS="$AXIS" -f '"$sub"' "$TALLY" > "$OUT_FILE"
2)
awk -v FORMAT="$FORM" -v xAXIS="$AXIS" -f "'"$sub"'" "$TALLY" > "$OUT_FILE"