博客專欄

        EEPW首頁 > 博客 > Linux統計項目代碼行數-wc

        Linux統計項目代碼行數-wc

        發布人:電子禪石 時間:2020-02-06 來源:工程師 發布文章
        Usage: wc [OPTION]... [FILE]...
            -c, --bytes, --chars print the byte counts
            -l, --lines print the newline counts
            -L, --max-line-length print the length of the longest line
            -w, --words print the word counts
                --help display this help and exit
                --version output version information and exit


        打開終端,用cd命令定位到工程所在的目錄,然后調用以下命名即可把每個源代碼文件行數及總數統計出來:

        find . "(" -name "*.m" -or -name "*.mm" -or -name "*.cpp" -or -name "*.h" -or -name "*.rss" ")" -print | xargs wc -l

        上面命令可以搜索這個工程。但包含了空格。

        find . "(" -name "*c" -or -name "*.h" -or -name "*cpp" ")" -print | xargs wc -l

        下面舉幾個例子:

        1.統計當前目錄下,py文件數量:

        1. find . -name "*.py" |wc -l

        2.統計當前目錄下,所有py文件行數:

        1. find . -name "*.py" |xargs cat|wc -l

        3.統計當前目錄下,所有py文件行數,并過濾空行:

        1. find . -name "*.py" |xargs cat|grep -v ^$|wc -l


        *博客內容為網友個人發布,僅代表博主個人觀點,如有侵權請聯系工作人員刪除。

        繼電器相關文章:繼電器工作原理


        時間繼電器相關文章:時間繼電器




        關鍵詞:

        相關推薦

        技術專區

        關閉
        主站蜘蛛池模板: 台湾省| 远安县| 长岭县| 大埔区| 和平县| 卢湾区| 阳西县| 乃东县| 合水县| 贺兰县| 额济纳旗| 怀远县| 万载县| 湖州市| 栖霞市| 铜山县| 中卫市| 枣阳市| 安吉县| 新疆| 比如县| 大姚县| 牡丹江市| 广西| 郎溪县| 达日县| 南阳市| 双柏县| 仙居县| 电白县| 离岛区| 大安市| 滕州市| 商城县| 静宁县| 滦平县| 醴陵市| 博白县| 确山县| 浦城县| 闸北区|