>>>>> "RJ" == Russell Johnson <[email protected]> writes:
RJ> I have the following in a bash script I’m writing: for each in
RJ> ${list}; do awk -F "\",\"" '$32 == "${each}" { print $32, $30, $33
RJ> }’ ${inputfile} done
RJ> Of course, ${each} doesn’t get populated because of the single
RJ> quotes in that line for the awk command.
RJ> I’ve tried several combinations of quotes and escaping. It seemed
RJ> that anything else I tried caused the awk script to fail.
RJ> Has anyone solved this?
If you want to use an external variable inside an awk script, you
generally need to use the -v var=val or (long) --assign=var=val command
line options. See --help or the appropriate manpage for details.
Something like (not tested):
awk -v each=${each} '$32 == each { print ... }' ${inputfile}
--
Russell Senior, President
[email protected]
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug