How to split a line into words separated by one or more spaces in bash? [duplicate]

s='foo bar baz'
a=( $s )
echo ${a[0]}
echo ${a[1]}
...

If you want a specific word from the line, awk might be useful, e.g.

$ echo $LINE | awk '{print $2}'

Prints the second whitespace separated word in $LINE. You can also split on other characters, e.g.

$ echo "5:6:7" | awk -F: '{print $2}'
6