Last active
December 21, 2015 01:39
-
-
Save vannell/6229327 to your computer and use it in GitHub Desktop.
Count LOC in files without taking commented or empty lines
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
#!/bin/bash | |
#Description count LOC in files without taking commented or empty lines | |
if [[ $# < 1 ]] | |
then | |
echo Give me some folder to count into | |
echo Add some options that will be passed to find after | |
echo "loc <folder> [options]" | |
exit 0 | |
fi | |
folder="$1" | |
shift | |
options=$@ | |
find "$folder" -type f $options | xargs 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