清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#!/usr/bin/perl -w use warnings; if(open LOGO ,"<sql.txt" or die "\ncan't find File: $!\n"){ if(open FILEOUT , ">fileout.txt" or die "\nFile create error: $!\n"){ $i = 0; while(<LOGO>){ #delete \n chomp($_); # trim space s/^\s+ | \s+$ //xg; #check start text if(/insert into|values/i){ $i = 1; }elsif(/;/){ $i = 0; } #check $_ not contain '' if($_ ne ''&& $i!=0){ printf FILEOUT "%80s" , "$_ --$i\n";#prinf comment $i= $i+1; }else{ $i = 0; print FILEOUT "$_\n"; } } close FILEOUT; } } close LOGO;