#!/bin/bash #grep -n "CREATE TABLE \`users\`" wlmarket_main.sql #sed -n '25,49p' wlmarket_main.sql grab create table line from dump file #get INSERTs for table from dump file into outfile #tac ls2com_ls2.sql | grep "INSERT\ INTO\ \`sponsor_tracking\`" > sponsor_trackingnew #mysql database < sponsor_tracking if [ "$1" == "" ] then echo "Format is inputFile/database" exit 1; else if [ "$2" == "" ] then echo "Format is inputFile/database" exit 1; else if [ -e $1 ] then database="$2" count="1" until=`cat $1 | wc -l` echo "$count / $until" while [ "$count" -le "$until" ] do cmd=$(sed -n "$count p" $1) echo "raw command:" echo $cmd echo "running raw command..." mysql -e "use $database; $cmd" echo "$count / $until complete" count=`expr $count + 1` done else echo "Couldn't find $1" exit 1; fi fi fi