mysqldump file:
awk 'BEGIN{temp_str = ""; find = "false"; end = "false";}{temp_str=temp_str""$0 ; if(match($0,"INSERT INTO `tb_name`") >0 ) find="true"; if(match($0,";") >0 ) end = "true"; if(end=="true" && find=="false"){ temp_str=""; end="false"}; if(end=="true" && find=="true") {print temp_str; end="false"; find="false"}}' .sql > _awk.sql |
binlog file:
awk 'BEGIN{temp_str = ""; find = "false"; end = "false";}{temp_str=temp_str""$0 ; if(match($0,"tb_name") >0 ) find="true"; if(match($0,";") >0 ) end = "true"; if(end=="true" && find=="false"){ temp_str=""; end="false"}; if(end=="true" && find=="true") {print temp_str; end="false"; find="false"}}' .sql > _awk.sql |