1.統(tǒng)計代碼行數(shù)命令
統(tǒng)計 src 目錄下所有 .js 文件的代碼行數(shù)
find ./src -name "*.js"|xargs cat|grep -v ^$|wc -l
wc 命令返回結果
[行數(shù)] [詞數(shù)] [字節(jié)數(shù)]
-c 統(tǒng)計字節(jié)數(shù)。
-l 統(tǒng)計行數(shù)。
-m 統(tǒng)計字符數(shù)。這個標志不能與 -c 標志一起使用。
-w 統(tǒng)計字數(shù)。一個字被定義為由空白、跳格或換行字符分隔的字符串。
-L 打印最長行的長度。
2.文件夾中的所有文件中,查詢關鍵字
查詢所有包含 name 關鍵字的文件
find ./ | xargs grep name