2013-12-25 22:17:18 +11:00
|
|
|
# wc
|
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
> Count lines, words, and bytes.
|
2021-04-01 17:54:26 +02:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/wc>.
|
2013-12-25 22:17:18 +11:00
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
- Count all lines in a file:
|
2013-12-25 22:17:18 +11:00
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
`wc --lines {{path/to/file}}`
|
2013-12-25 22:17:18 +11:00
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
- Count all words in a file:
|
2016-02-10 19:46:05 +02:00
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
`wc --words {{path/to/file}}`
|
2016-02-10 19:46:05 +02:00
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
- Count all bytes in a file:
|
2013-12-25 22:17:18 +11:00
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
`wc --bytes {{path/to/file}}`
|
2013-12-25 22:17:18 +11:00
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
- Count all characters in a file (taking multi-byte characters into account):
|
2013-12-25 22:17:18 +11:00
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
`wc --chars {{path/to/file}}`
|
2020-05-29 13:01:37 +02:00
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
- Count all lines, words and bytes from `stdin`:
|
2020-05-29 13:01:37 +02:00
|
|
|
|
|
|
|
`{{find .}} | wc`
|
2021-10-14 01:32:18 +08:00
|
|
|
|
|
|
|
- Count the length of the longest line in number of characters:
|
|
|
|
|
2021-11-09 08:48:09 +01:00
|
|
|
`wc --max-line-length {{path/to/file}}`
|