2025-03-14 21:59:59 -06:00
|
|
|
# wc
|
|
|
|
|
|
|
|
|
|
> Count lines, words, and bytes.
|
|
|
|
|
> More information: <https://www.gnu.org/software/coreutils/manual/html_node/wc-invocation.html>.
|
|
|
|
|
|
|
|
|
|
- Count all lines in a file:
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`wc {{[-l|--lines]}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Count all words in a file:
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`wc {{[-w|--words]}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Count all bytes in a file:
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`wc {{[-c|--bytes]}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Count all characters in a file (taking multi-byte characters into account):
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`wc {{[-m|--chars]}} {{path/to/file}}`
|
2025-03-14 21:59:59 -06:00
|
|
|
|
|
|
|
|
- Count all lines, words and bytes from `stdin`:
|
|
|
|
|
|
|
|
|
|
`{{find .}} | wc`
|
|
|
|
|
|
|
|
|
|
- Count the length of the longest line in number of characters:
|
|
|
|
|
|
2025-03-19 19:23:44 -06:00
|
|
|
`wc {{[-L|--max-line-length]}} {{path/to/file}}`
|