#
# 生成修改记录
#
# 使用方法:将Source Insight搜索结果保存为0829.txt
# 将该文件保存为xxx.pl和0829.txt放在同一目录下,双击执行
# 结果在生成的result.txt中
#
use strict;
my ($eachfile,$line,$output,$prev,$count,$ret,$prev_path);
$eachfile = undef;
$prev = undef;
$prev_path = undef;
$line = 0;
$count = 0;
$output = ">result.txt";
open OUT,$output or die $!;
#my @myfiles = <*.txt>;
#for $eachfile (@myfiles)
$eachfile = "<0829.txt";
{
open FH,$eachfile or die $!;
$line = 0;
while() {
$line++;
if(($_ =~ /([\S]*)\s/))
{
if(defined($prev))
{
$ret = $prev cmp $1;
if($ret == 0)
{
$count++;
} else {
print $prev_path,"";
print OUT $prev_path,"";
$count = 1;
$prev = $1;
if(($_ =~ /\s\(([\S]*)\)/))
{
$prev_path = $1;
}
}
} else {
$prev = $1;
$count++;
if(($_ =~ /\s\(([\S]*)\)/))
{
$prev_path = $1;
}
}
}
}
close FH;
}
print "finish search ! \n";
print OUT "finish search ! \n";
close OUT;
阅读(933) | 评论(0) | 转发(0) |