添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
犯傻的杨桃  ·  QmlProfiler ...·  3 月前    · 
任性的菠菜  ·  variables 定义 | ...·  1 年前    · 
完美的毛衣  ·  How do I expire a PHP ...·  1 年前    · 
#!/usr/bin/perl 
$dir='/home/websphere/WebSphere/AppServer/profiles/AppSrv01/logs/server1';
$file = 'SystemErr.log';
$mon_file="$dir/$file";
print "\$mon_file is $mon_file\n";
@warn_arr = qw/连接已关闭 NullPointException IndexOutOfBound/;
foreach $a (@warn_arr){
open (C,"<","$a.tmp") ;
while (<C>){
$count = $_;
}
print "\$count is $count\n";

$info =`tac $mon_file | grep "$a" | head -1`;

open (A ,"<","$mon_file") || die "$!\n";
$i=0;
while (<A>) {
$num++;
if ($_ =~ /$a/i){$i++;$b=$num};
};

if ( $i !=0 && $i != $count && defined($count)) {
open (B ,"<","$mon_file") || die "$!\n";
while (<B>) {
print $_ if ($.>=$b and $.<=$b + 10) }};
open (C,">","$a.tmp");
print C ("$i\n");

}