Created
February 17, 2013 22:21
-
-
Save ahmetb/4973807 to your computer and use it in GitHub Desktop.
Quick SLoC counter in CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Counts source lines of code in current directory. Replace *.java with your source extension. | |
# (ignores empty lines) | |
find . -type f -name '*.java' -exec cat {} \; | sed '/^\s*$/d' | wc -l | |
# to ignore comments (in languages where comments start with #) | |
find . -type f -name '*.java' -exec cat {} \; | sed '/^\s*#/d;/^\s*$/d' | wc -l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In most package managers (apt, brew etc) there is
sloccount
package. It gives detailed stats, you better use it.