今天在处理mysqlbinlog的时候insert,和update 语句比较长换行比较多,有点类似于
要截取整段文字,如果截取
<phase a>
this is a test
hellow world
</phase>
用下面的shell就可以处理整段文字,获取<phase a> 开头,</phase>结尾的一段
[root@rac1 ~]# sed -ne '/\<phase a\>/,/^<\/phase>/p' 1.txt
<phase a>
this is a test
hellow world
</phase>
[root@rac1 ~]# sed -ne '/<phase a>/,/^<\/phase>/p' 1.txt
<phase a>
this is a test
hellow world
</phase>