当前位置:网站首页>How to count the number of project code lines

How to count the number of project code lines

2022-07-07 08:56:00 beibeix2015

find . "(" -name "*" ")" -print | xargs wc -l

 1、 Open the terminal , use cd command Navigate to the directory where the project is located .

2、 Call the following command to count the number of lines and total number of each source code file

(1) Including the empty line ( The code lines of each file will be listed ):

find . "(" -name "*.m" -or -name "*.mm" -or -name "*.c" -or -name "*.h" -or -name "*.xib" -or -name "*.pch" ")" -print | xargs wc -l

(2) Empty lines are not included ( Only the total number of rows will appear ):

find . "(" -name "*.m" -or -name "*.mm" -or -name "*.c" -or -name "*.h" -or -name "*.xib" -or -name "*.pch" ")" -print | xargs grep -v "^$"|wc -l

// If there is anything else . Suffix files can continue to be added, such as -or -name "*.java"

3、 enter

grep -v "^$"

Removing blank line comments is also included in the code line count

linux Detailed explanation of pipeline symbols

 linux In command “|” Pipe symbol

 linux Medium wc command

Linux The Conduit  

xargs Detailed command  

 

原网站

版权声明
本文为[beibeix2015]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207070616463661.html