Last active
March 14, 2019 01:01
-
-
Save m-esm/7e4c71f41986577976e01a9e84866710 to your computer and use it in GitHub Desktop.
count total lines of code in a directory - linux bash
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
for type in ts css html less json; do | |
echo "total lines of .$type files"; | |
lines=$(( find ./ -path './*/node_modules' -prune -o -name "*.$type" -print0 | xargs -0 cat ) | wc -l); | |
echo "$lines"; | |
done; | |
# example output: | |
# total lines of .ts files | |
# 34377 | |
# total lines of .css files | |
# 10423 | |
# total lines of .html files | |
# 125003 | |
# total lines of .less files | |
# 14517 | |
# total lines of .json files | |
# 519477 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment