Skip to content

Instantly share code, notes, and snippets.

@johncarl81
Created January 3, 2017 01:36
Show Gist options
  • Save johncarl81/7d3d08d1dcbcbf8326ea8d4ea8cca347 to your computer and use it in GitHub Desktop.
Save johncarl81/7d3d08d1dcbcbf8326ea8d4ea8cca347 to your computer and use it in GitHub Desktop.
#!/bin/bash
countLines(){
totalCount=0;
for file in `find . -name *.java`; do
numLines=`cat $file | sed -r ':a; s%(.*)/\*.*\*/%\1%; ta; /\/\*/ !b; N; ba' | sed '/^\s*$/d' | sed '/^import/ d' | sed '/^package/ d' | wc -l`;
totalCount=$(( $totalCount + $numLines ));
done
echo $totalCount
}
echo Source code files:
countLines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment