ControlScripts: fix hrk parse generated output: one-space separator, no measure units...
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 31 Jul 2010 10:11:40 +0000 (13:11 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 31 Jul 2010 10:12:00 +0000 (13:12 +0300)
ControlScripts/parse_hrk.sh

index 6a448e4..b996e27 100755 (executable)
@@ -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