From 2cdeb728679f6b61b840de38a5f47eca8266f244 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Thu, 4 Apr 2013 08:17:34 +0300 Subject: [PATCH] calculate only numbers --- bin/v-update-web-domain-traff | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/v-update-web-domain-traff b/bin/v-update-web-domain-traff index 6afe9e10..506b4ede 100755 --- a/bin/v-update-web-domain-traff +++ b/bin/v-update-web-domain-traff @@ -45,9 +45,12 @@ bytes=0 # Parsing log while read line; do - if [[ '-' != "$line" ]] && [[ 0 -lt "$line" ]]; then + + if [[ "$line" =~ ^[0-9]+$ ]]; then + line=${line#0} bytes=$(($bytes + $line)) fi + done < $log_file # Converting to Mb