When I run the following command on terminal,
awk /984/ $files | awk -F, \'{OFS=\",\";print $1,$4,$17}\'
where,
To store variables in an array, output needs to be in a form like this:
result=$(one two "more data")
echo ${result[2]}
more data
Data separated by spaces. So tweak your output to give that format.
Can you give an example of what you get out of:
awk '/984/' $files | awk -F, '{OFS=",";print $1,$4,$17}'
It may be shorten to:
awk -F, '/984/ {OFS=",";print $1,$4,$17}' $files