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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -