For example :
In my file mytxt
field1 field2
------ -------
this are numbers 12345
this letters abc def ghi
Let's say I want to store the first field in an array
i=0
while read line; do
field_one[$i]=$(echo $line | awk '{print $1}')
echo ${field_one[i]}
((i++))
done < mytxt
That would give me the "this" 2 times in the output
Any ideas of how could I store them in an array and get The output:
this are numbers
this letters
I have tried changing delimeters , squeezing spaces , and using sed but I'm stuck. any hint would be aprecciate it .
My final goal is to store both fields in an array.