I'm using bash scripts and for some reasons I must only use bash and not the php or perl and etc.
I got some results from mysql with this code and saved them in a variable called result
:
result=$(mysql -NB -u "$mysqlUser" -p"$mysqlPass" -D "$mysqlDb" -e "select * from sites" )
and this is the result:
1 news.bitcoin.com NULL 840119 stopped 1509636516 1509636688 0 0 0 0
2 blog.blockchain.com NULL NULL stopped NULL 0 0 0 0 0
now I want to parse this results line by line and convert each line to an array and access them for example in this way:
echo $results[0,0] # 1
echo $results[0,3] # 840119
echo $results[0,6] # 1509636688
echo $results[1,1] # blog.blockchain.com
echo $results[1,3] # NULL
echo $results[1,6] # 0
accourding to this post we can declare arrays through andices like multidimensional.
Would you please help me with this issue, or inform me of any other possible ways to walk through this task?
Thanks in advance