首页 > 代码库 > usage.sh

usage.sh

#########################################################################
# File Name: usage.sh
# Author:
# mail:
# Created Time: 2014年12月05日 星期五 15时36分52秒
#########################################################################
#!/bin/bash

if [ -z "$1" ];then
    echo -e "Usage:\n\t${0##*/} <bugreport file or dumpstate file> \n"
    exit 1
fi

echo -e "\n To find the result in $1_result.txt \n"
:> $1_result.txt
:> $1_tmp

#grep  ‘\[K\]‘ $1 | grep ‘%‘ | while read line;
grep -A 5 "CPU Usage" $1 | grep "%" | while read line;
    
    do
        tmpstr1=${line##*]}
        echo $tmpstr1 >> $1_tmp
    done;

cat $1_tmp | sort -n -r -k 1 | awk ‘{print $1 " \t"  $3 }‘ > $1_result.txt

rm $1_tmp





usage.sh