When I run the following command on terminal,
awk /984/ $files | awk -F, \'{OFS=\",\";print $1,$4,$17}\'
where,
When you say:
result=($(awk /string/ $files | awk -F, '{OFS=",";print $1,$4,$17}'))
the output would be split by whitespace. Set IFS
to a newline character, and you should see the desired result. Say:
IFS=$'\n' result=($(awk /string/ $files | awk -F, '{OFS=",";print $1,$4,$17}'))
instead to capture different lines of output into an array.