zoukankan      html  css  js  c++  java
  • mysql perl 抓取update语句

    <pre name="code" class="html"><pre name="code" class="html">自带的全局变量,默认值为“
    ".  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!
    ";  
            exit(-1);  
    
                   }; 
    my $a=$ARGV[0];
    my $b=$ARGV[1];
    my $c=$ARGV[2];
    local $/='/*!*/;';
    open (A,"<","$a");
         while (<A>){
          if  (( $_ =~/$bs+$c/i ) or ($_ =~/$bs+`zjzc`.`$c`/i) ){
          print $_;
            };
          };
    
    插入SQL:
    if ( $#ARGV < 2 ){  
            print "please input file  update|insert table_namee!
    ";  
            exit(-1);  
    
    
                   }; 
    my $a=$ARGV[0];
    my $b=$ARGV[1];
    my $c=$ARGV[2];
    local $/='/*!*/;';
    open (A,"<","$a");
         while (<A>){
          if  (( $_ =~/$bs+intos+$c/i ) or ($_ =~/$bs+intos+`zjzc`.`$c`/i) ){
          print $_;
            };
          };


    
    
    
    
    
    
    
       
    
    
  • 相关阅读:
    CSP-S2019游记
    BZOJ4668 冷战
    [ZJOI2007]仓库建设
    CF833B The Bakery
    决策单调性优化DP+分治优化决策单调性
    穿越栅栏 Overfencing
    控制公司 Controlling Companies
    派对灯 Party Lamps
    CSP2019总结
    差分约束
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199298.html
Copyright © 2011-2022 走看看