tldr/pages/common/wc.md

29 lines
572 B
Markdown
Raw Normal View History

2013-12-25 11:17:18 +00:00
# wc
2021-11-09 07:48:09 +00:00
> Count lines, words, and bytes.
> More information: <https://www.gnu.org/software/coreutils/wc>.
2013-12-25 11:17:18 +00:00
2021-11-09 07:48:09 +00:00
- Count all lines in a file:
2013-12-25 11:17:18 +00:00
2021-11-09 07:48:09 +00:00
`wc --lines {{path/to/file}}`
2013-12-25 11:17:18 +00:00
2021-11-09 07:48:09 +00:00
- Count all words in a file:
2021-11-09 07:48:09 +00:00
`wc --words {{path/to/file}}`
2021-11-09 07:48:09 +00:00
- Count all bytes in a file:
2013-12-25 11:17:18 +00:00
2021-11-09 07:48:09 +00:00
`wc --bytes {{path/to/file}}`
2013-12-25 11:17:18 +00:00
2021-11-09 07:48:09 +00:00
- Count all characters in a file (taking multi-byte characters into account):
2013-12-25 11:17:18 +00:00
2021-11-09 07:48:09 +00:00
`wc --chars {{path/to/file}}`
2021-11-09 07:48:09 +00:00
- Count all lines, words and bytes from `stdin`:
`{{find .}} | wc`
- Count the length of the longest line in number of characters:
2021-11-09 07:48:09 +00:00
`wc --max-line-length {{path/to/file}}`