Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f422c0

Browse filesBrowse files
authored
Update wc.md
修改了文档中例子部分出现的问题。
1 parent 23c4b25 commit 9f422c0
Copy full SHA for 9f422c0

1 file changed

+9-9Lines changed: 9 additions & 9 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎command/wc.md‎

Copy file name to clipboardExpand all lines: command/wc.md
+9-9Lines changed: 9 additions & 9 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff 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 # 查看文件的字节数、字数、行数
4645
wc test.txt
4746
# 输出结果
4847
7 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
# 输出结果
6565
8
6666
```

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.