Skip to content

Instantly share code, notes, and snippets.

@vannell
Last active December 21, 2015 01:39
Show Gist options
  • Save vannell/6229327 to your computer and use it in GitHub Desktop.
Save vannell/6229327 to your computer and use it in GitHub Desktop.
Count LOC in files without taking commented or empty lines
#!/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