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
Post a Comment