其实很简单,就是利用正则表达式,从文件中抽取,可以用awk或sed,例如:
1. 抽取数据库 imysql_1 的全部SQL语句
#假设数据库 imysql_1 的下一个是 imysql_2 DBNAME1="imysql_1" DBNAME2="imysql_2" sed -n “/^-- Current Database: \`$DBNAME1\`/,/^-- Current Database: \`$DBNAME2\`/p” imysql_20100601.sql
2. 抽取数据表 user_base 的全部SQL语句
#假设数据表 user_base 的下一个是 user_detail DBTAB1="user_base" DBTAB2="user_detail" sed -n “/^-- Table structure for table \`$DBTAB1\`/,/^-- Table structure for table \`$DBTAB2\`/p” imysql_20100601.sql
上面只是个例子,正则表达里面的表达式可以根据各自导出文件的内容进行修改
最近评论
1 天 13 小时 前
1 天 15 小时 前
1 周 1 天 前
1 周 1 天 前
2 周 1 天 前
2 周 3 天 前
3 周 4 天 前