在 bash 中计算(非空白)代码行 [英] count (non-blank) lines-of-code in bash
本文介绍了在 bash 中计算(非空白)代码行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Bash 中,如何计算项目中非空代码行的数量?
In Bash, how do I count the number of non-blank lines of code in a project?
推荐答案
cat foo.c | sed '/^s*$/d' | wc -l
如果您考虑评论空白行:
And if you consider comments blank lines:
cat foo.pl | sed '/^s*#/d;/^s*$/d' | wc -l
虽然,这取决于语言.
这篇关于在 bash 中计算(非空白)代码行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文