-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
Description
HOME="$tmp_store_dir" top -H -b -d $top_delay -n 2 |
awk '{
if (idx == 3 && $NF == "java") # $NF is command
# only print 4th text block(idx == 3), aka. process info of second top update
print $1 " " $9 # $1 is thread id, $9 is %cpu
if ($0 == "")
idx++
}' | sort -k2,2nr这部分逻辑是不是有些问题?为什么只抓4th? 执行了一下,没有输出
改成下面是OK的
HOME="$tmp_store_dir" top -H -b -d $top_delay -n 2 |
awk '{
if ($NF == "java") # $NF is command
# only print 4th text block(idx == 3), aka. process info of second top update
print $1 " " $9 # $1 is thread id, $9 is %cpu
}' | sort -k2,2nrawk语句