从日志文件中提取不同线程的日志

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /bin/bash
 
function extract_pthread_log
{
        i=0
        while [ $i -lt 20 ]
        do
                if [ $i -lt 10 ]; then
                        var="pthread0$i"
                else
                        var="pthread$i"
                fi
                filename="$var.log"
                #echo "[$var, $filename]"
                grep -i $var $1 > $filename
                i=$[$i+1]
        done
}
 
if [ -f $1 ]
then
        extract_pthread_log
fi
 
exit 0