Python 3.x approach (just the alternative solution):
sum_digits.py script:
import sys
with open(sys.argv[1], 'r') as f:
for l in f:
print("sum", sum(int(d) for d in l if d.isdigit()))
Usage:
python3 sum_digits.py yourfile
The output:
sum 8
sum 15
sum 13