How to count the lines of code in a project?

Bernard El-Hagin bernard.el-hagin at lido-tech.net
Mon Dec 22 23:42:20 PST 2003


owner-freebsd-questions at freebsd.org wrote:

>
>Hello. How to count the number of lines in all *.c file in a directory?
>
>I can think of this on csh:
>
>> grep -c "" `find . -name "*.c"` | sed "s/.*:/e=e+/" > /tmp/countlines.py
>
>And edit the py file, and "e=0" as first line, "print e" as the last
>line, and execute the python script. wooo pretty cool for a newbie like
>me:)
>
>So is there a better method?


I think a *slightly* better method is to use:


wc -l *.c


;-)


-- 
Cheers,
Bernard


More information about the freebsd-questions mailing list