#!/bin/bash

find $1 -type f > temp

while read line
do
    grep -v ^$ "$line" | wc -l >> counter
done < temp

total=0
while read lines others
do
    ((total+=$lines))
done < counter

echo $total
rm counter
rm temp