File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,9 @@ wc [选项]... --files0-from=F
3434## 例子
3535
3636``` shell
37- wc -l * # 统计当前目录下的所有文件行数
38- wc -l * .js # 统计当前目录下的所有 .js 后缀的文件行数
39- find . * | xargs wc -l # 当前目录以及子目录的所有文件行数
40- wc test.txt # 查看文件的字节数、字数、行数
37+ wc -l * # 统计当前目录下的所有文件行数及总计行数。
38+ wc -l * .js # 统计当前目录下的所有 .js 后缀的文件行数及总计行数。
39+ find . * | xargs wc -l # 当前目录以及子目录的所有文件行数及总计行数。
4140```
4241
4342查看文件的字节数、字数、行数
@@ -46,21 +45,22 @@ wc test.txt # 查看文件的字节数、字数、行数
4645wc test.txt
4746# 输出结果
48477 8 70 test.txt
49- 行数 单词数 字节数 文件名
48+ # 行数 单词数 字节数 文件名
5049```
5150
5251用wc命令怎么做到只打印统计数字不打印文件名
5352
5453``` shell
55- wc -l test.txt
54+ wc -l < test.txt
5655# 输出结果
57- 7 test.txt
56+ 7
5857```
5958
60- 用来统计当前目录下的文件数
59+ 用来统计当前目录下的文件数(不包含隐藏文件)
6160
6261``` shell
63- ls -l | wc -l
62+ # 要去除TOTAL行
63+ expr $( ls -l | wc -l) - 1
6464# 输出结果
65658
6666```
You can’t perform that action at this time.
0 commit comments