Perl 打印特定行日志
来源:互联网 发布:淘宝模板设计师 编辑:程序博客网 时间:2024/06/05 21:08
#!/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"); }
0 0
- Perl 打印特定行日志
- perl打印日志的时间格式
- 打印特定元素内容
- 打印特定星图案
- sed之打印特定行与连续行
- 打印 perl 目录
- Perl打印输出二进制文件
- perl 打印复杂数据结构
- 日志打印
- 日志打印
- 日志打印
- 日志打印
- 打印日志
- 日志打印
- 日志打印
- 日志打印
- 打印日志
- 日志打印
- 百度web前端面试题--2014年
- MAC自带SVN的配置 +ConerStone的Svn Server的配置 +.a文件的上传
- ActionBar 的全面介绍
- springMVC系列之文件上传
- hadoop常见错误及解决办法(三)
- Perl 打印特定行日志
- spark内核简介
- android性能优化--布局优化
- ubuntun一些软件的安装,环境配置的基本步骤
- springmvc 多个视图解析器 排序
- android 添加界面介绍
- 烧录程序发送给工厂前注意事项
- AppStore这些坑爹审核!(转)
- js数组去重