#!/usr/bin/perl use Encode; use Encode::CN; use DBI; use Switch; use strict; use Net::HandlerSocket; use threads; use Time::HiRes 'time'; print "请输入数字确认要把所有表分成几份"; my $var=0; $var=<STDIN>; chop ($var); print "请输入总表名"; my $read=0; $read=<STDIN>; chop ($read); my $readtxtname=$read; my @a; open(FILE,"$readtxtname"); while (<FILE>) { chomp; if(defined($_ )) { push @a,$_; } } close(FILE); my $many=int(@a/$var); my $count=@a; print $many."\n"; print $count."\n"; my $i=1; while($i<=$var){ my $outtxtname="alltablename_exportname_"."$i"."\.txt"; my $index=$many*($i-1); if($i==$var) { while($index<=@a-1){ open(FILE,">>$outtxtname"); syswrite(FILE,"@a[$index]\n"); syswrite(FILE,"@a[$index+1]\n"); close(FILE); $index=$index+2; } } else { while($index<=$many*$i-1){ open(FILE,"@a[$index+1]\n"); close(FILE); $index=$index+2; } } $i++; } print "ok";
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。