let's say I have this:
ARRAY=()
NUM_EXTRACTED=$(cat somefile.txt | awk '/magic/{i++; print > i "_extracted.txt"} END {print i}')
for (( i=1; i<=$NUM_EXTRACTED; i++)); do
LINE=$(cat "$i"_extracted.txt)
ARRAY+=("$LINE")
done
this script takes all lines in somefile.txt that contain the word 'magic' and put them into the array ARRAY
how can I fill ARRAY directly, without storing the lines out into temporary files?