Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Source analytics
#!/bin/bash
set -u
# usage example to find all Java source files: ./sloc-by-extension java
EXTENSION="${1}"
for dir in $(ls -d */); do
pushd ${dir} >/dev/null
LIST=$(find . -name "*.${EXTENSION}" | grep -iv test)
if [ ! -z "${LIST}" ]; then
echo ${dir} | sed 's/\/\///g'
echo $(wc -l ${LIST} | tail -n 1)
fi
popd >/dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.