Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!mit-eddie!bbn!ginosko!uunet!ncrlnk!ncr-sd!hp-sdd!hplabs!hp-ses!hpcuhb!hpda!hpcupt1!hpisod2!decot From: decot@hpisod2.HP.COM (Dave Decot) Newsgroups: comp.lang.c Subject: Re: C source lines in file Message-ID: <2550098@hpisod2.HP.COM> Date: 13 Aug 89 21:37:57 GMT References: <35120@ccicpg.UUCP> Organization: Hewlett Packard, Cupertino Lines: 11 # cloc - count lines of code for i in $* do blanklines=`grep "^[ ]*$" $i | wc -l` loc=`sed -e "s/^#.*/k/" $i | /lib/cpp | sed -e "/^[ ]*$/d" -e 1d | wc -l` alllines=`cat $i | wc -l` commentlines=`echo $alllines - $blanklines - $loc | bc` echo $i \ CODE $loc \ COMMENTS $commentlines \ TOTAL $alllines done