<pre name="code" class="html"><pre name="code" class="html">自带的全局变量,默认值为“\n". perl中”行“的概念就由$/决定 [root@zjzc01 binlog]# cat binlog.sh ls -ltr mysql-bin.* | grep -v index | awk '{print $NF}' | while read A do echo $A mysqlbinlog $A >$A.sql perl binlog.pl $A.sql update SystemRole >$A.sql.txt rm -rf $A.sql done [root@zjzc01 binlog]# cat binlog.pl if ( $#ARGV < 2 ){ print "please input file update|insert table_namee!\n"; exit(-1); }; my $a=$ARGV[0]; my $b=$ARGV[1]; my $c=$ARGV[2]; local $/='/*!*/;'; open (A,"<","$a"); while (<A>){ if (( $_ =~/$b\s+$c/i ) or ($_ =~/$b\s+`zjzc`\.`$c`/i) ){ print $_; }; }; 插入SQL: if ( $#ARGV < 2 ){ print "please input file update|insert table_namee!\n"; exit(-1); }; my $a=$ARGV[0]; my $b=$ARGV[1]; my $c=$ARGV[2]; local $/='/*!*/;'; open (A,"<","$a"); while (<A>){ if (( $_ =~/$b\s+into\s+$c/i ) or ($_ =~/$b\s+into\s+`zjzc`\.`$c`/i) ){ print $_; }; };
mysql perl 抓取update语句
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
下一篇:mysql 开启事务
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
根据Excel生成Insert或Update语句
根据Excel生成SQL
EXCEL SQL