1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages.zh/common/wc.md

29 lines
663 B
Markdown
Raw Permalink Normal View History

2021-10-13 08:16:54 +02:00
# wc
> 计数行、单词或字节。
> 更多信息:<https://www.gnu.org/software/coreutils/manual/html_node/wc-invocation.html>.
2021-10-13 08:16:54 +02:00
- 计数文件中的行数:
`wc {{[-l|--lines]}} {{路径/到/文件}}`
2021-10-13 08:16:54 +02:00
- 计数文件中的单词数:
`wc {{[-w|--words]}} {{路径/到/文件}}`
2021-10-13 08:16:54 +02:00
- 计数文件中的字节数:
2021-10-13 08:16:54 +02:00
`wc {{[-c|--bytes]}} {{路径/到/文件}}`
2021-10-13 08:16:54 +02:00
- 计数文件中的字符数(考虑所有多字节的字符):
`wc {{[-m|--chars]}} {{路径/到/文件}}`
2021-10-13 08:16:54 +02:00
- 使用 `stdin`,按顺序计数行、单词和字节:
2021-10-13 08:16:54 +02:00
`{{find .}} | wc`
- 计算最长行的长度(字符数):
`wc {{[-L|--max-line-length]}} {{路径/到/文件}}`