#!/bin/sh # count blank lines, white spaces and comments # 17.8.98 Werner Heuser # # ToDo # - look for tabs too # - find " ; ", " { ", " } " etc. # - find the same items in *.gz # - is there a corresponding approach for binary files? rm -f tmp.txt SUM_BLANK=0 SUM_COMMENT=0 SUM_BLANKS=0 SUM_X=0 for FILE in `find 1 2 -type f -print` do file $FILE | egrep "text" >/dev/null if [ $? -eq 0 ]; then echo "FILE $FILE text" echo "FILE $FILE text ****************************************" >>tmp.txt # find blank lines INC_B=`egrep "^$" $FILE | wc -l` egrep "^$" $FILE >>tmp.txt echo "INC_B $INC_B" SUM_BLANK=`bc<>tmp.txt echo "INC_C $INC_C" SUM_COMMENT=`bc<>tmp.txt echo "INC_X $INC_X" SUM_X=`bc<>tmp.txt echo "INC_M $INC_M" SUM_BLANKS=`bc<