【发布时间】:2010-05-31 14:20:30
【问题描述】:
我现在正在上一门软件工程课程。我们的任务是评估 Mozilla 的 Thunderbird。我们的任务是评估 Thunderbird 的大小。我们需要使用的一个指标是项目中的代码行数。 (代码行意味着不包括 cmets 或新行)。
有没有一种标准的方法来查找行数,还是我最好只是破解一个脚本来做到这一点?
我认为我可以这样做:
# remove all comments
find -name *.java | \
sed "/\/*/,\*\// s/.*//g | \ # remove multiline comments
sed s/\/\///g # remove single line comments
# count not empty lines
find -name *.java | grep -c "<character>"
但我需要对每种文件类型都这样做。似乎应该已经有一些实用程序可以做到这一点。 (Mac/unix 兼容的东西会更好)。
【问题讨论】:
标签: line-count