In fact, it is very simple to use regular expressions, extracted from files, can be used with awk or SED, for example:
1. Extracting all SQL statements from the database Imysql_1
dbname1= "Imysql_1"
Dbname2= "Imysql_2"
Sed-n "/^--current database: \ ' $DBNAME 1\ '/,/^--the current database: \ ' $DBNAME 2\ '/P" imysql_20100601.sql
2. Extracting all SQL statements from the data table User_base
#假设数据表 User_base's next is user_detail.
dbtab1= "User_base"
Dbtab2= "User_detail"
Sed-n "/^--table structure for table \ ' $DBTAB 1\ '/,/^--table structure for table \ ' $DBTAB 2\ '/P" imysql_20100601.sql
Above is just an example, the expression inside the regular expression can be modified according to the contents of the respective export file
--------------------------------------Split Line--------------------------------------
Http://zhishuedu.com Training is a professional quality training brand jointly launched by senior MySQL expert Ye Jinlong and Wu Bingxi, which mainly includes MySQL DBA combat optimization and Python Operation Development Course, which is the most conscientious and quality training course in the industry.
This article is from the "Lao Ye teahouse" blog, please be sure to keep this source http://imysql.blog.51cto.com/1540006/1879711
FAQ Series | Extracting some of the library tables from the dump file