Having trouble getting code below to work. The idea is to loop through 3 arrays parallelly and per iteration get 3 values to insert in database.
The insertion works, but the loops never end and inserts duplicate rows.
How should this be done?
/Paul
readarray rows1 < /tmp/tempfile1
readarray rows2 < /tmp/tempfile2
readarray rows3 < /tmp/tempfile3
for i in "${rows1[@]}"; do
for j in "${rows2[@]}"; do
for k in "${rows3[@]}"; do
mysql --user=$DB_USER --password=$DB_PASSWD $DB_NAME << EOF
INSERT INTO $TABLE (\`column1\`,\`column2\`,\`column3\`) VALUES ("$i","$j","$k");
EOF
done
done
done