- 论坛徽章:
- 0
|
本帖最后由 la19850302 于 2015-05-11 17:05 编辑
文本格式如下 create.sql
Table structure for table table_name_1
sssssxxx
Table structure for table table_name_1
Table structure for table table_name_2
sssssxx
Table structure for table table_name_2
Table structure for table table_name_3
sssssx
Table structure for table table_name_3
.....同上类推
Table structure for table table_name_100
sssssxxx
Table structure for table table_name_100
比如我想取 table_name_30 和 table_name_1,最终结果如下
Table structure for table table_name_1
sssssxxx
Table structure for table table_name_1
Table structure for table table_name_31
sssssxxx
Table structure for table table_name_31
必须写两次 sed(如下) ,对于大文件来说,create.sql 可能是好几十个G ,时间成本是单次提取的两倍,有没有办法提高提取效率,一次性提取出来
sed -n 's/Table structure for table table_name_1/,/Table structure for table table_name_1/p' create.sql > table_name_1.sql
sed -n 's/Table structure for table table_name_31/,/Table structure for table table_name_31/p' create.sql > table_name_31.sql
谢谢大家
|
|