In case anyone in future is reading this and wondering how to actually get multi-line awk output into a bash array:
$ cat ./tst.sh
# ensure globbing is off and set IFS to a newline after saving original values
oSET="$-"; set -f; oIFS="$IFS"; IFS=$'\n'
array=( $(
awk 'BEGIN{
print "qh1adm 20130711151154 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ"
print "qh1adm 20130711151155 : tp import all QH1 u6 -Dsourcesystems=E7B,B17"
print "qh1adm 20130711151200 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ"
}'
) )
# restore original IFS and globbing values
IFS="$oIFS"; set +f -"$oSET"
numElts="${#array[@]}"
if (( numElts > 1 ))
then
for (( i=0; i < numElts; i++ ));
do
printf "array[%d]: %s\n" "$i" "${array[$i]}"
done
fi
$
$ ./tst.sh tmp
array[0]: qh1adm 20130711151154 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ
array[1]: qh1adm 20130711151155 : tp import all QH1 u6 -Dsourcesystems=E7B,B17
array[2]: qh1adm 20130711151200 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ
but apparently none of that is actually necessary in this case and the whole thing should probably just be done within the one awk command.
The above has been updated to address issues raised by and input from @CharlesDuffy below.