C source lines in file

Kazuaki Ueno kazua-u at ascii.JUNET
Mon Aug 14 22:15:41 AEST 1989


In article <35120 at ccicpg.UUCP> swonk at ccicpg.UUCP (Glen Swonk) writes:

 |Does anyone have a program or a method of determing
 |the number of C source lines in a source file?
 |My assumption is that comments don't count as source
 |lines unless the comment is on a line with code.
 |
	How about trying this:

grep -v '^#[ 	]*include' <filename>  | /lib/cpp -P | grep -v '^[ 	]*$' | wc -l 
( Inside []'s are a SPACE and a TAB. )

	You will get the number of 'effective' C source lines with this list of 
	commands.  Of course I do not care what you do with it. :-)
	
--
Kazuaki Uyeno	ASCII Corporation, Tokyo, Japan
also a student of Univ. of Tokyo
kazua-u at ascii.JUNET



More information about the Comp.lang.c mailing list