Created
December 27, 2014 20:49
-
-
Save bendmorris/2f3013c32fd2c6baccf4 to your computer and use it in GitHub Desktop.
Count # of files and total lines by file type, in all git repos starting from the current directory
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 | |
DIR=$(pwd) | |
REPOS=$(find . -type d -name .git) | |
echo "-- Directory: " $DIR | |
echo "-- Repos: " $REPOS | |
for i in hx py xml; do | |
echo $i | |
FILES=$(for j in $REPOS; do cd "$DIR/$j/../"; git ls-files --full-name | grep "\.$i" | while read line; do echo "$DIR/$j/../$line"; done; done) | |
echo " files:" "$(echo $FILES | wc -w)" | |
echo " lines:" "$(for j in $FILES; do cat $j; done | wc -l)" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment