Without solving the several special character issues:
Awk is able to process the whole file a lot faster:
#!/bin/bash LINE_COUNT=0 FILE_SLOWEST=1 FILE_LONGEST=1 awk '{ val=$NF+0; if(NR==1) {min=val;max=val} if(max<val){max=val} if(min>val){min=val} sum+=val } END { avg=sum/NR print (sum,avg,max,min) }' logfile.txt | { read SUM AVG MAX MIN echo "The Sum of values is = $SUM" echo "The averaged value of times is = $AVG" echo "The maximum of times is = $MAX" echo "The minimum of times is = $MIN" } Understand that to keep the read values after the pipe has ended you need something like:
read SUM AVG MAX MIN < <(awk ...)