Ricky

链接

RSS

RSS Link
选择一天中最大记录
去掉烦人的内存或磁盘空间不足

用Perl查找包含非中文字符的记录

Ricky posted @ 2015年7月28日 09:04 in Other , 1039 阅读
#!/usr/bin/perl
#Author: 
#Version: 0.1
#Description: find all non chs chars
#Usage: 

use Getopt::Std;

Getopt::Std::getopts('f:', \%options);
$cifaFile=$options{f};
$nonChsFile="result.$cifaFile";

no warnings qw(uninitialized);
use open ":encoding(utf8)",":std";

open(cifa,"$cifaFile") || die "can't open";
open(nonChs,">$nonChsFile") || die "can't open";

while(<cifa>){
    $line=$_;
    #split with seperator
    @array = split(/\|ine,3);
    if ($array[1] ne "0" and $array[2]!~/^[\x{4E00}-\x{9FA5}]+$/){
        #write search result if found
        print nonChs $line;
    }
}

close(cifa);
close(nonChs);

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter