{"id":827,"date":"2014-08-03T03:52:37","date_gmt":"2014-08-03T03:52:37","guid":{"rendered":"http:\/\/ixyzero.com\/blog\/?p=827"},"modified":"2014-08-03T03:52:37","modified_gmt":"2014-08-03T03:52:37","slug":"%e8%ae%a1%e7%ae%97%e6%96%87%e4%bb%b6%e4%bb%a3%e7%a0%81%e8%a1%8c%e6%95%b0%e7%9a%84%e5%87%a0%e7%a7%8d%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/ixyzero.com\/blog\/archives\/827.html","title":{"rendered":"\u8ba1\u7b97\u6587\u4ef6\/\u4ee3\u7801\u884c\u6570\u7684\u51e0\u79cd\u65b9\u6cd5"},"content":{"rendered":"<p>\u5f88\u65e9\u4e4b\u524d\u7528C\u8bed\u8a00\u5199\u8fc7\u4e00\u4e2a\u6bd4\u8f83\u7b80\u5355\u7684\u4ee3\u7801\u7edf\u8ba1\u7684\u529f\u80fd\uff0c\u6709\u4ee3\u7801\u884c\u6570\u7edf\u8ba1\u3001\u6ce8\u91ca\u884c\u6570\u7edf\u8ba1\u2026\u2026\u5dee\u4e0d\u591a\u5c31\u662f\u8fd9\u6837\u7684\u529f\u80fd\uff0c\u4e4b\u524d\u4e5f\u4e13\u95e8\u4e3a\u6b64\u5728\u7f51\u4e0a\u641c\u7d22\u8fc7\u7c7b\u4f3c\u7684\u5de5\u5177\/\u811a\u672c\uff0c\u627e\u5230\u4e862\u4e2a\u4e0d\u9519\u7684\u811a\u672c\uff08lines\u548ccloc\uff09\uff0c\u7136\u540e\u5462\uff0c\u60f3\u4e86\u60f3\uff0c\u5176\u5b9e\u7528Linux\u4e0b\u7684\u547d\u4ee4\u884c\u7ec4\u5408\u4e5f\u53ef\u4ee5\u5b8c\u6210\u7c7b\u4f3c\u7684\u4ee3\u7801\u884c\u6570\u7edf\u8ba1\u7684\u529f\u80fd\uff08\u4f46\u8c8c\u4f3c\u6ce8\u91ca\u7684\u7edf\u8ba1\u5c31\u6bd4\u8f83\u9ebb\u70e6\u4e86[\u521a\u624d\u60f3\u5230\u4e86sed\u7684\u5339\u914d\u533a\u95f4\u7684\u529f\u80fd\uff0c\u4e0d\u8fc7\u53ef\u4ee5\u8bd5\u8bd5]\uff09\uff0c\u4ee5\u540e\u4e5f\u53ef\u80fd\u4f1a\u627e\u5230\u66f4\u597d\u7684\u5de5\u5177\u6216\u662f\u81ea\u5df1\u5199\u4e00\u4e2a\u529f\u80fd\u66f4\u5b8c\u5907\u7684\u51fa\u6765\u3002<\/p>\n<div>Lines-1.8.py\u8fd9\u4e2a\u6587\u4ef6\u7684\u4f5c\u7528\u662f\u8ba1\u7b97\u6587\u4ef6\u884c\u6570\uff0c\u63d0\u4f9b\u7684\u9009\u9879\u6709\u201c-R\/-r\/-rxd\/-max\/D\u201d\uff0c\u4f46\u8bf4\u5b9e\u8bdd\uff0c\u5728Linux\u4e0b\u7684\u547d\u4ee4\u7ec4\u5408\u6548\u679c\u6bd4\u8fd9\u4e2a\u8981\u6765\u5f97\u5feb\uff0c\u800c\u4e14\u65b9\u4fbf\uff1a<br \/>\nfind . -type f -exec ls {} ; | xargs cat | wc -l\u00a0#\u53bb\u6389\u5176\u4e2d\u6587\u4ef6\u7684\u603b\u4e2a\u6570\u5373\u53ef<br \/>\nfind . -type f -exec ls {} ; | wc -l\u00a0#\u6587\u4ef6\u603b\u4e2a\u6570<\/div>\n<div><\/div>\n<div>\u7b49\u6548\u4e8e\uff1a<br \/>\npython Lines-1.8.py -R .<\/div>\n<div>cloc\u8fd9\u4e2a\u529f\u80fd\u4e0d\u9519\uff0c\u8fd8\u7b97\u662f\u6bd4\u8f83\u51c6\u786e\u7684\uff0c\u4f46\u662f\u5728\u6d4b\u8bd5Python\u811a\u672c\u7684\u65f6\u5019\u6709\u4e9b\u5730\u65b9\u4e0d\u77e5\u9053\u8be5\u600e\u4e48\u7b97\uff0c\u6bd4\u5982\u8bf4&#8221;&#8217;\u4e4b\u95f4\u7684#\u662f\u5426\u88ab\u5f53\u4f5c\u662fcomment\u7b26\u53f7\u3002<\/div>\n<div><\/div>\n<h6>\u76f8\u5173\u94fe\u63a5\u5730\u5740\uff1a<\/h6>\n<div>\n<ul>\n<li>cloc (Count Lines Of Code) counts, and computes differences of, comment lines, blank lines, and physical lines of source code in many programming languages\u00a0&#8211;\u00a0<a href=\"http:\/\/sourceforge.net\/projects\/cloc\/\" target=\"_blank\">http:\/\/sourceforge.net\/projects\/cloc\/<\/a><\/li>\n<li>lines &#8211; Simple Python script \u2014 Helps count total lines of code of a project &#8211; <a href=\"https:\/\/code.google.com\/p\/lines\/\" target=\"_blank\">https:\/\/code.google.com\/p\/lines\/<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5f88\u65e9\u4e4b\u524d\u7528C\u8bed\u8a00\u5199\u8fc7\u4e00\u4e2a\u6bd4\u8f83\u7b80\u5355\u7684\u4ee3\u7801\u7edf\u8ba1\u7684\u529f\u80fd\uff0c\u6709\u4ee3\u7801\u884c\u6570\u7edf\u8ba1\u3001\u6ce8\u91ca\u884c\u6570\u7edf\u8ba1\u2026\u2026\u5dee\u4e0d\u591a\u5c31\u662f\u8fd9\u6837\u7684\u529f\u80fd\uff0c\u4e4b\u524d\u4e5f [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[282,283],"class_list":["post-827","post","type-post","status-publish","format-standard","hentry","category-tools","tag-cloc","tag-lines"],"views":2842,"_links":{"self":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/comments?post=827"}],"version-history":[{"count":0,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/posts\/827\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/media?parent=827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/categories?post=827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixyzero.com\/blog\/wp-json\/wp\/v2\/tags?post=827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}