#!/bin/bash

awk -F "" '{a=0;for (i=1;i<=NF;i++){if ($i >= 1 && $i <= 5){a++}}b=b+a}{print "line"NR" number: "a}END{print "sum is "b}'