]> p2p-next.cs.pub.ro Git - p2p-testing-infrastructure.git/commitdiff
ControlScripts: use $a + 0 in awk to extract numeric part from a string
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 30 Jul 2010 14:24:22 +0000 (17:24 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Fri, 30 Jul 2010 14:24:22 +0000 (17:24 +0300)
ControlScripts/parse_hrk.sh

index 694d37f0ccb3660d29809c6b0e1f58b7aa9cd48b..6a448e47a775c5bd5fb112838c58a344b6640b5f 100755 (executable)
@@ -44,10 +44,8 @@ echo "time percent upspeed dlspeed" > $DATA_FILE
 # Clean and parse the log file
 grep '^ps' $LOG_FOLDER/$LOG_FILE | awk -F '[ \t<>:,]+' '
 {
-       idx = match($10, "^[0-9]+");
-       download = substr($10, idx, RLENGTH);
-       idx = match($14, "^[0-9]+");
-       size = substr($14, idx, RLENGTH);
+       download = $10 + 0;
+       size = $14 + 0;
 
        percent = 100 * download / size;
        percent_string = sprintf("%.2f", percent);