shell 腳本實例(一) - 校正systrace時間戳

#!/bin/bash
#$1 is systrace file;
#set -x

grep -A 80 "entries-in-buffer/entries-written" "$1"
echo -n "\033[31m 從上邊trace log中查找和systrace 0點相對應的時間戳並輸入: \033[0m"
read ts0
echo "please wait for a few minutes ....."

awk -v timezero=$ts0 -F "timescope" '{gsub(/[0-9]*[.][0-9][0-9][0-9][0-9][0-9][0-9][:]/,"timescope&timescope");if($0~/\[00[0-7]\]/) printf("%6f ", $2-timezero);gsub(/timescope/,"",$0);if($0~/\[00[0-7]\]/) print $0}'   $1 > $1.timestamp


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章