Awk
(sem loops de conchas e correntes de dutos):
awk 'BEGIN{ OFS=", "; print "Interface, In Errors, Out Errors" }
/line protocol /{ ifc=$1 }
/input errors/{ in_err=$1 }
/output errors/{ print ifc, in_err, $1 }' "$DATAFILE/$rname.intfs"
A saída:
Interface, In Errors, Out Errors
GigabitEthernet0/0, 1, 275
GigabitEthernet0/1, 0, 42