Hi. I want to use a BASH variable inside AWK that is an AWK command. Here is my test code that I plan to make more complicated if I can find a solution to this problem.
exptransform=(
'print "test"'
)
awk -v awk_exptransform="${exptransform}" '
BEGIN{
printf ("Test.n")
printf ("This is another test: %sn",awk_exptransform)
awk_exptransform
}
'
This gives successful output for the first two lines in the begin statement. The third line returns nothing. How do I get AWK to execute the contents of the variable as a command?
I have done many searches on the Internet and on this site with a variety of search terms. I have read the relevant section of sed & awk (Dougherty, & Robbins, 1997). What am I missing? Is this possible?
Sincerely,
Dante Picchioni