在bash数(非空)行-OF- code [英] count (non-blank) lines-of-code in bash
本文介绍了在bash数(非空)行-OF- code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在bash中,我怎么算code的非空行数在一个项目?
解决方案
猫的foo.c | SED'/ ^ \\ s * $ / D'|厕所-l
如果你考虑的意见空行:
猫foo.pl | SED'/ ^ \\ S *#/ D; / ^ \\ s * $ / D'|厕所-l
虽然,这是依赖于语言。
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
Although, that's language dependent.
这篇关于在bash数(非空)行-OF- code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文