I am facing a problem while writing a shell script. i have table in a database where there is a text field.. i need to write that field into a file.
database fields are id, file_name, text
here is my script
#!/bin/bash
while read -a row
do
cat <<EOF >/root/${row[1]}
${row[2]}
EOF
sleep 1
done < <(echo "SELECT * FROM installation WHERE status = 1" | mysql -h 127.0.0.1 -u root -padmin -D data -s)
I have tried with
echo "${row[2]}" > /root/${row[1]}
But its writing the 1st line only, but the text field is multiline text and i need write full text in that file
please help