Skip to content

Instantly share code, notes, and snippets.

@jiaozhu
Created March 7, 2014 01:53
Show Gist options
  • Save jiaozhu/ce98c5a8795f018fba04 to your computer and use it in GitHub Desktop.
Save jiaozhu/ce98c5a8795f018fba04 to your computer and use it in GitHub Desktop.
自动检测WebLogic日志中的Exception信息段
#!/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