#!/bin/bash
find $1 -type f -print \
| while read item ; do
    file $item | sed -e 's/.*: //' | grep -s -q text
    text=$?
    if [ $text -eq 0 ] ; then
        wc $item
    fi
done \
| awk '
{
    lines+=$1;
    words+=$2;
    chars+=$3;
}
END {
    printf "%9d %9d %9d\n",lines,words,chars;
}'
ViewGit