END { myvar = (system("gawk '{x+=$1} END{print x/NR}' dantest.txt")); print "myvar is " myvar #system( gawk -f sum.awk dantest.txt ) }