Line Count in my Qt Project.
-
Thanks All for the help.
Moving to solved. -
find and grep...find and grep
-
@Kent-Dorfman would you like to elaborate a bit more?
-
find . -iname \*.h -o -iname \*.cpp -exec grep \\\; {} \; | wc -l
Would find all the .h and .cpp find in the current directory, and count the number of lines with a semicolon. For the most things, that's probably a pretty useful count of code LOC, and requires no extra tools to be installed.
-
@wrosecrans
This don't do the folder search recursive right. ? -
-
yes, the default behaviour of find "in unix" is recursive. grep is a pattern matcher. I use
find . -type f -iname \*.h -o -iname \*.hpp -o \ -iname \*.c -o -iname \*.cc -o -iname \*.cxx \ -o -iname \*.cpp | \ xargs -n 1 egrep -v "^[ \t]*$" | wc -l
prints total of all target file lines (found recursively). ignores blank lines
-
Hi @Kent-Dorfman
Cool, Linux commands are always awesome.
I just Added*.qml
to the command so i can include qml also for the line count.find . -type f -iname \*.h -o -iname \*.hpp -o -iname \*.qml -o \ -iname \*.c -o -iname \*.cc -o -iname \*.cxx \ -o -iname \*.cpp | \ xargs -n 1 egrep -v "^[ \t]*$" | wc -l
Thanks a lot again
@mrjj @Eddy @jsulm @J-Hilk @Kent-Dorfman @aha_1980 @wrosecrans .Have a great day.
-
This tool will help you.
cloc-1.74.It is collected in PyMake project.
github https://github.com/AbelTian/PyMake.git (fetch)
github https://github.com/AbelTian/PyMake.git (push)
origin https://gitee.com/drabel/PyMake (fetch)
origin https://gitee.com/drabel/PyMake (push)In demo/ dir.