sql - update mysql column with bash -


this code got far:

i=1 inputfile="data.txt"     cat $inputfile | while read the_data;         while [ $i -le 100 ];             echo "update table set row=\"$the_data\" id=$i;"             i=$(( $i+1 ))         done     done | mysql -u root -pmy_pass db_name; 

this code partially works, problem first line in data.txt inserted each row instead of new data lines right one.

any ideas?

duh, fixed it:

i=1 inputfile="data.txt"     cat $inputfile | while read the_data;             echo "update table set row=\"$the_data\" id=$i;"             i=$(( $i+1 ))     done | mysql -u root -pmy_pass db_name; 

:-)


Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -