Perform floating point arithmetic in shell script variable definitions
May 16, 2013 in answer
ANSWER:
You may not want to use bc for this. Perhaps awk would work better:
awk 'sum+=$1;ENDprint sum/NR' /path/to/file
Bruce Ediger from http://unix.stackexchange.com/questions/76069

New Comments