Browse Source

calculate only numbers

Serghey Rodin 13 years ago
parent
commit
2cdeb72867
1 changed files with 4 additions and 1 deletions
  1. 4 1
      bin/v-update-web-domain-traff

+ 4 - 1
bin/v-update-web-domain-traff

@@ -45,9 +45,12 @@ bytes=0
 
 
 # Parsing log
 # Parsing log
 while read line; do
 while read line; do
-    if [[ '-' != "$line" ]] && [[ 0 -lt "$line" ]]; then
+
+    if  [[ "$line" =~ ^[0-9]+$ ]]; then
+        line=${line#0}
         bytes=$(($bytes + $line))
         bytes=$(($bytes + $line))
     fi
     fi
+
 done < $log_file
 done < $log_file
 
 
 # Converting to Mb
 # Converting to Mb