Created
March 7, 2014 01:53
-
-
Save jiaozhu/ce98c5a8795f018fba04 to your computer and use it in GitHub Desktop.
自动检测WebLogic日志中的Exception信息段
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#==================================================================== | |
# chkException.sh | |
# | |
# Copyright (c) 2013, 赵伟杰 <[email protected]> | |
# All rights reserved. | |
# Distributed under the GNU General Public License, version 3.0. | |
# | |
# 自动检测WebLogic日志中的Exception信息段 | |
# | |
# V 0.2, Date: 2013-08-29 | |
#==================================================================== | |
cd /home/bea/tf #此目录根据需要修改 | |
if [ -f result.txt ];then | |
rm result.txt | |
fi | |
FILELIST=`ls *.out` | |
for lf in $FILELIST | |
do | |
NRLIST=`grep -n Exception $lf | awk -F ':' '{print $1}'` | |
for i in $NRLIST | |
do | |
start=$((i-3)) | |
end=$((i+8)) | |
sed -n "$start,$end p" $lf >> result.txt | |
done | |
done | |
cat result.txt | uniq > result.tmp | |
mv result.tmp result.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment