find . -type f |grep -v "^./public" |grep -v "^./modules"|grep -v "^./templates"|xargs cat |wc -l
Run Code Online (Sandbox Code Playgroud)
find . -type fxargs将从标准输入读取文件列表并将所有文件作为选项传递给cat.cat 将所有文件打印到标准输出如果要单独计算每个文件中的行数,请更改xargs cat |wc -l 为xargs wc -l