Well, the error is due to the fact you missed the single quotes around the awk program. Look at my previous post: single quotes are mandatory.
Anyway, I misinterpreted your first post, since you talk about calculating the mean of 20 numbers, so I thought you had a file with 20 lines. My awk command line calculates the mean of the number in the ninth field of each line.
From your last example, I think you want help just for the first part of your issue, that is to store the number in a shell variable. To do this use
command substitution:
which assigns the output of the command to the variable. To extract the number from the line, again you can use awk or eventually the command
cut. For example:
Code:
var=$(/usr/local/bin/istcp -t $iprec -p 20000 | grep KB/sec | awk '{print $9}')