-
Counting Source Lines?
Anyone know where I can get a simple source line number counter from? I just want to count non-blank lines in a C++ project. Something with a windows GUI is preferable.
I used to use a thing called C Metrics, but it seems to have vanished from the face of the Earth.
Thanks
-
C-Metrics!
huzzah!
-just realized that it's doubly zipped/rarred for some reason...hope that's no big problem for anyone
Get winrar if you don't have it already! (which you should...)
-
Interesting, 7-zip doesnt have rar compression capability, and using zip compression gives a 871 KB filesize. Same for gzip on a tar archive. bzip2 only gives 841 KB as improvement.
7-zip itself gives a 691 KB archive.
Either way I cant reduce the filesize enough to attach it to my post though :mad:
-
Thanks!
I don't seem to be able to write anything under 38,000 lines. :)
Found a nice completely free compression utility which did the job:
http://www.izsoft.dir.bg/izarc.htm
-
why don't you try searching. We have done this before here
the answer you probably want is by Perspective
Code:
grep -n .\* in-file > out-file
-
That command adds line numbers to a file, to count lines in one file:
To count lines in the source tree:
Code:
$ grep "" -R source_dir | wc -l
To count non-blank lines:
Code:
$ grep -v "^$" -R source_dir | wc -l
If you run Windows, you can get grep.exe by installing Cygwin, it's a free download, just google for the name.
-
or just change -n to -c, no need to pipe to wc ;)
grep -c .\* in-file