#! /bin/bash AvgEstimate=$(gawk 'BEGIN{FS=",";} {x+=$1} END{print x/NR}' $1) AvgActual=$(gawk 'BEGIN{FS=",";} {x+=$2} END{print x/NR}' $1) gawk -f calc.awk AvgEstimate=$AvgEstimate AvgActual=$AvgActual $1