My file looks like
"dog" 23 "a description of the dog" 123 456 "21"
"cat" 5 "a description of the cat" 987 654 "22"
I'm loading the file line by line into an array
filename=$1
while read -r line
do
animal_array=($line)
*do stuff
done < $filename
What I want to see:
animal_array[1] --> "dog"
animal_array[2] --> 23
animal_array[3] --> "a description of the dog"
animal_array[4] --> 123
animal_array[5] --> 456
aninal_array[6] --> "21"
What I get:
animal_array[1] --> "dog"
animal_array[2] --> 23
animal_array[3] --> "a
animal_array[4] --> description
animal_array[5] --> of
animal_array[6] --> the
animal_array[7] --> dog"
animal_array[8] --> 123
animal_array[9] --> "21"
Struggling to find a way to do a check for "quotes" before I read the line into the array. The quotes need to be in the array.