I'd like to write a Bash script that reports a sum. I'm starting with 20 text files that have the text "LOC: 54" somewhere in them (the "54" could be any integer). So here are the results of searching for this line with grep:
# grep LOC *
ceil.c: * LOC: 38
count_newlines.c: * LOC: 28
even.c: * LOC: 35
every_product.c: * LOC: 48
expand_factors.c: * LOC: 54
factor.c: * LOC: 41
fibonacci.c: * LOC: 49
get_element.c: * LOC: 37
is_composite.c: * LOC: 43
isprime.c: * LOC: 36
largest.c: * LOC: 37
max_product.c: * LOC: 68
mult_list.c: * LOC: 38
nlist.c: * LOC: 37
palindrome.c: * LOC: 72
prime_factors.c: * LOC: 57
remove_dups.c: * LOC: 50
select_products.c: * LOC: 36
square_list.c: * LOC: 31
sum_list.c: * LOC: 38
What could I do to pull just the numerical information together to produce a single number, the sum of the above numbers? I believe in the above example it would be 873.