Conversion to uppercase - tr

Hi,

I am trying to convert the $i in loop from lower to upper case but getting error like ' awk: 0602-502 The statement cannot be correctly parsed. The source line is 1.' ..

Requirement: I have many table in script XXX.sql which starting with 'ABC_','AbC_','aBc_' etc.. same thing for table starting with XYZ. I need all these table names.

Could u plz help me on that.

grep -iE "ABC_|XYZ_" /ukdw/prd/working/TDMatrix/srualcb02/ukdw/prd/bin/XXX.sql | awk '{printf("%s ",$0)}END{print "\n"}' | sed 's/,/ /g;s/ / /g' |
awk 'BEGIN{FS=" "}
{
for(i=1;i<=NF;i++)
{
fieldToCheck= $i | tr '[a-z]' '[A-Z]'
if (index($fieldToCheck,"ABC")>0){print $i};
if (index($fieldToCheck,"XYZ")>0){print $i};
}
}'

fieldToCheck= `echo $i | tr '[a-z]' '[A-Z]'`

Replace this:

fieldToCheck= $i | tr '[a-z]' '[A-Z]'
if (index($fieldToCheck,"ABC")>0){print $i};
if (index($fieldToCheck,"XYZ")>0){print $i};

with:

fieldToCheck=toupper($i)
if (index(fieldToCheck,"ABC")>0){print $i}
if (index(fieldToCheck,"XYZ")>0){print $i}

Regards