I'm trying to get values from a MySQL database, for a later substitution with perl, everything works fine but if a record contain space " " the variables will be set uncorrectly.
Example if in the database I have:
- sede = "street"
- fede = "calvin and hobbes"
- lede = "12"
the result for the variables will be:
- $TAGSEDE = "steet"
- $TAGFEDE = "calvin"
- $TAGLEDE = "and"
I understood there is something wrong in setting $DBDATAF but, I can't identify it (english isn't my mother language so some misunderstanding are more than a possibility).
DBDATAF=$(mysql -u$DBUSER -p$DBPASS -se "USE $DBNAME; SELECT sede, fede, lede FROM $DBTABL WHERE cf='$CFPI'")
read TAGSEDE TAGFEDE TAGLEDE <<< $DBDATAF
/usr/bin/perl -p -i -e "s/TAGDATAINSERT/$TAGDATAINSERT/g" $i