Counting number of lines in multi-file large code
Hello all,
Is anybody aware of any free utility for calculating number of lines in a multi-file (40-50 files language C, platform RedHat 9.0) code. Ideally I am looking for something that may work like this: <utility_name> input >> *.c output << < total number of lines in *.c>> I checked out programmers_heaven.com. There are some utilities like this for MS Windows, but they operate on single file. I thought about using cat or grep, but it does'nt seem like a smart idea. Here's how this question came about: I recently had an interview with a FEA s/w development company. The interviewer asked me how many lines is your code ? I told the interviewer that I never kept track of that! Thanks Abhijit |
Re: Counting number of lines in multi-file large c
You're using Unix, right? The command you want is wc -l So:
cat *.c | wc -l for all .c files in a directory; or more complex: find . -type f -name "*.[ch]pp" -exec cat {} \; | wc -l to find all files .hpp and .cpp files in the currect directory tree and count them. For more info, read man pages :) |
Re: Counting number of lines in multi-file large c
Hello Dr. Jasak,
wow! you nailed it. Thanks for your answer. Abhijit |
Re: Counting number of lines in multi-file large c
and if u are in windows .... and want to count lines in VS project .. isaw one program on codeproject.com that does that for you.
|
All times are GMT -4. The time now is 03:02. |