From afd67e13a92205d40f9b7af42637bc0c33fd261c Mon Sep 17 00:00:00 2001 From: Razvan Deaconescu Date: Sat, 31 Jul 2010 13:11:40 +0300 Subject: [PATCH] ControlScripts: fix hrk parse generated output: one-space separator, no measure units, correct upload and download speed, two decimal digits --- ControlScripts/parse_hrk.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ControlScripts/parse_hrk.sh b/ControlScripts/parse_hrk.sh index 6a448e4..b996e27 100755 --- a/ControlScripts/parse_hrk.sh +++ b/ControlScripts/parse_hrk.sh @@ -43,13 +43,20 @@ echo "time percent upspeed dlspeed" > $DATA_FILE # Clean and parse the log file grep '^ps' $LOG_FOLDER/$LOG_FILE | awk -F '[ \t<>:,]+' ' +BEGIN { + count = 1; +} + { + dlspeed = $6 + 0; + upspeed = $8 + 0; + download = $10 + 0; size = $14 + 0; + percent = 100.0 * download / size; - percent = 100 * download / size; - percent_string = sprintf("%.2f", percent); - print percent, $6, $8; -}' | cat -b >> $DATA_FILE + printf "%d %.2f %.2f %.2f\n", count, percent, upspeed, dlspeed; + count++; +}' >> $DATA_FILE exit 0 -- 2.39.5