Script programming help with AWK

I've scripting code issue by using with AWK command. My existing command in the script is,

for i in `find ${INPUTDIR} -maxdepth 1 -iname XYZ_??_${PLACE}_*.${SUFFIX} | awk -F'/XYZ_' '{print "XYZ_"$2}'`

But here instead of the letter "Z", the new files are coming with XYA, XYB, and XYC as well. So my loop condition should be,

for i in `find ${INPUTDIR} -maxdepth 1 -iname XY?_??_${PLACE}_*.${SUFFIX} | awk -F'/XYZ_' '{print "XYZ_"$2}'` 

From above "for" loop I am unable to write the awk condition to find out the files with XYA, XYB and XYC in my script. How to I find with wild card by using awk command here. Can anyone help me out in this?

I am using LINUX o/s.

-F '/XYZ'

means that the / character is a field separator all by itself, so are X and Y and Z

Was that you wanted?

try below:-

for i in `find ${INPUTDIR} -maxdepth 1 -iname XY?_??_${PLACE}_*.${SUFFIX} | awk '{print FS $2}'` FS="XY[ABCZ]_"

BR

Thanks for all replies. The above trial was not working in my script.

But I would like to give up in another way of my programming issue as below. The for loop is:

for i in `find ${INPUTDIR} -maxdepth 1 -iname XYZ_??_${PLACE}*.${SUFFIX} | awk -F'/REZ' '{print "REZ_"$2}'`

From above condition, the condition is fit for only the file which are contains "REZ_" only. But there are the files other than "REZ_" like "RES_", "RET_" and "REX_". By using above for loop, how do I check other than "REZ_"? I am unable to write the script condition here.

I am able to give the find statement by using LINUX command but unable to fix with AWK programming.

for i in `find ${INPUTDIR} -maxdepth 1 -iname RE?_??_${PLACE}*.${SUFFIX} | awk -F'/REZ' '{print "REZ_"$2}'`

For my understand, you need get the file name only

for i in `find . -maxdepth 1 -iname XY?_??_*_*.ttt -exec basename {} \; `
for i in `find . -maxdepth 1 -iname REZ_??_*_*.ttt -exec basename {} \; `

Would like to know whether possible to check with wildcard files by using AWK? From the above "for" loop statement, can't we use "?" instead of by given "REZ_" can use "RE?_". Any ideas?