Last active
April 13, 2020 19:16
-
-
Save bhpayne/fb63fa0816be63733488162baebf9b14 to your computer and use it in GitHub Desktop.
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
function lcount() { | |
count_py_files=`find . -type f | grep \.py$ | wc -l` | |
count_c_files=`find . -type f | grep \.c$ | wc -l` | |
count_csv_files=`find . -type f | grep \.csv$ | wc -l` | |
count_png_files=`find . -type f | grep \.png$ | wc -l` | |
count_html_files=`find . -type f | grep \.html$ | wc -l` | |
count_sh_files=`find . -type f | grep \.sh$ | wc -l` | |
count_xml_files=`find . -type f | grep \.xml$ | wc -l` | |
py_line_count=`find . -name "*.py" -type f -exec grep . {} \; | sed -n '/^# /!p' | wc -l` | |
tex_line_count=`find . -name "*.tex" -type f -exec grep . {} \; | sed -n '/^% /!p' | wc -l` | |
html_line_count=`find . -name "*.html" -type f -exec grep . {} \; | wc -l` | |
sh_line_count=`find . -name "*.sh" -type f -exec grep . {} \; | wc -l` | |
xml_line_count=`find . -name "*.xml" -type f -exec grep . {} \; | wc -l` | |
echo "{'hash':'$1', 'date':'$2', 'python file count':${count_py_files}, 'c file count':${count_c_files}, 'csv file count':${count_csv_files}, 'png file count':${count_png_files}, 'html file count':${count_html_files}, 'sh file count':${count_sh_files}, 'xml file count':${count_xml_files}, 'python line count':${py_line_count}, 'tex line count':${tex_line_count}, 'html line count':${html_line_count}, 'sh line count':${sh_line_count}, 'xml line count':${xml_line_count}}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bash function which takes two arguments and returns a dict of line counts and file counts