linux脚本统计代码行数

网上收集的答案后加以修改,感谢

https://blog.csdn.net/KimBing/article/details/89400816
https://www.cnblogs.com/lvchaoshun/p/11491329.html
https://www.iteye.com/blog/hittyt-1700584

PS:没有Linux环境的可以使用git bash运行

# 啥都不排除
find . "(" -name "*.c" -or -name "*.h" -or -name "*.cpp" ")" -print|xargs cat|wc -l

# 排除空行
find . "(" -name "*.c" -or -name "*.h" -or -name "*.cpp" ")" -print|xargs cat|grep -v ^$|wc -l

# 排除空行和//注释
find . "(" -name "*.c" -or -name "*.h" -or -name "*.cpp" ")" -print|xargs cat|grep -v -e ^$ -e ^s*//.*$|wc -l
原文地址:https://www.cnblogs.com/pureLaw/p/12732741.html