In a Bash script I would like to split a line into pieces and store them in an array.
The line:
Paris, France, Europe
I would like
This is similar to the approach by Jmoney38, but using sed:
string="1,2,3,4" array=(`echo $string | sed 's/,/\n/g'`) echo ${array[0]}
Prints 1