Let\'s say I have a text file \'demo.txt\' who has a table in it like this:
1 2 3
4 5 6
7 8 9
Now, I want to read each line separat
Sorry to bump but I believe there's an easy and very clean solution for your request:
$ cat demo.txt
1 2 3
4 5 6
7 8 9
$ while read line;do IFS=' ' myarray+=(${line}); done < demo.txt
$ declare -p myarray
declare -a myarray='([0]="1" [1]="2" [2]="3" [3]="4" [4]="5" [5]="6" [6]="7" [7]="8" [8]="9")'
$