Boss let me put the information in the log summary, good trouble, wrote this script to help work.
Need to improve: 1. Crawl log time, only the last time, and this script will catch
2. Requires two time difference (e.g. 15:23:34 and 23:23:34), not completed
3.aix don't get used to it
#!/bin/ksh# Enter the destination file directory cd /user/lyb# Enter the identification field echo start time end time customer group number of customers >> /user/file10#for i in 1 2 3 4 5 6 7 8 9 10 11 12 "while [ true ]doecho " please input the filename "#变量名为文件名, Read -p does not make read filename #取出需要的字段, when there are multiple identical fields in the file, Without judging the conditions s1= ' grep ' received the registration Response message packet, start performing task resolution " $filename | sed ' s/\. *//g ' s2= ' grep "terminate the task processing finished, service exits" $filename | sed ' s/\. *//g "s3= ' grep " loads the customer group. * Users $filename | sed ' s/^.*\[//g ' | sed ' s /\].*$//g ' s4= ' grep "loaded. * users" $filename | sed ' s/^.*\[//g ' | sed ' s/\].*$//g ' #将取出的字段输入到文件echo "$s 1" " $s 2 " " $s 3" " $s 4 " >> /user/file10 done
#计算时间差sql语句
#select Round ((to_date (' 2014-11-13 12:22:23 ', ' yyyy-mm-dd hh24:mi:ss ')-to_date (' 2014-11-13 12:12:32 ', ' yyyy-mm-dd Hh24:mi:ss ') *24*60) time from dual;
Crawl specific fields in the Log shell script