I have a sqlite with a table with 2 columns. I would like to get the two values of the columns in every variable or in an array. For instance:
table A
COLUMN A COLUMN B
credit and risk David
nothing susan
.....
and I would like to obtain: Variable A="credit and risk" and variable B="David" then Variable A ="nothing" and variable B= "susan" and so on. I'm trying with these code but if the column A have space I can't get the string complete, for example I obtain "credit" only. My code:
valores=($(sqlite3 alcampo.db "select DESCRIPTION, URL FROM SUBCATEGORYS"))
cnt=${#valores[@]}
echo "cuenta es ... $cnt"
for (( i=0 ; i<cnt ; i++ ))
do
echo "Record No. $i: ${valores[$i]}"
fieldA=${valores[0]}
echo "campo a es ... $fieldA"
fieldB=${valores[1]}
echo "campo B es ... $fieldB"
done
Could you help me please? Thanks