Last active
July 27, 2020 05:55
-
-
Save nonstriater/62c96681a4b4d036ce3daf6f6d3ee945 to your computer and use it in GitHub Desktop.
Revisions
-
nonstriater revised this gist
Jul 27, 2020 . No changes.There are no files selected for viewing
-
nonstriater created this gist
Jul 27, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/bin/sh homeDir=$1 #cd /Users/ranwenjie/Desktop/c:c++/Bitcoin-xcode/bitcoin/src cd $homeDir # 目录内的源码统计 echo "" > /tmp/1.txt find . -maxdepth 1 -type d -print0 | while read -d '' -r dir; do files=("$dir"/*) sum=`find $files -regex '.*\.\(cpp\|c\|h\)' -type f -print0 | xargs -0 wc -l | sort -nr | head -n 1 | awk '{print $1}'` printf "%-20s %s \n" "$dir" "$sum" >> /tmp/1.txt done sort -k 2 -nr < /tmp/1.txt # src目录下的源码统计 find ./ -maxdepth 1 -regex '.*\.\(cpp\|c\|h\)' -type f -print0 | xargs -0 wc -l | sort -nr | head -n 1 | awk '{print $1}'