Hi All,
Not sure if I'm just missing something here but this looks correct, I've re-written the code a bit to eliminate variables and isolate the awk statement:
Code:
echo "${Mrl101Array[*]}" | tr ' ' "\n" | sort -n -t"_"
Produces the following output:
Code:
16_100_sat
19_100_thur
19_100_wed
26_100_fri
28_100_tue
29_100_sun
30_100_mon
Now the following awk code:
Code:
echo "${Mrl100Array[*]}" | tr ' ' "\n" | sort -n -t"_" | awk 'BEGIN { FS = "_" } ; {sum+=$1} END { print "Average = ",sum}'
Tells me that the sum is 1. I had it as sum/NR to get the average but removed it to see what the sum was because it wasn't working.
Am I just overlooking a small syntax issue here?