2013-12-25 22:17:18 +11:00
|
|
|
# wc
|
|
|
|
|
2019-11-14 10:58:45 -06:00
|
|
|
> Count lines, words, or 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
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Count lines in file:
|
2013-12-25 22:17:18 +11:00
|
|
|
|
|
|
|
`wc -l {{file}}`
|
|
|
|
|
2016-02-10 19:46:05 +02:00
|
|
|
- Count words in file:
|
|
|
|
|
|
|
|
`wc -w {{file}}`
|
|
|
|
|
|
|
|
- Count characters (bytes) in file:
|
2013-12-25 22:17:18 +11:00
|
|
|
|
|
|
|
`wc -c {{file}}`
|
|
|
|
|
2016-01-07 18:31:27 +01:00
|
|
|
- Count characters in file (taking multi-byte character sets into account):
|
2013-12-25 22:17:18 +11:00
|
|
|
|
|
|
|
`wc -m {{file}}`
|
2020-05-29 13:01:37 +02:00
|
|
|
|
|
|
|
- Use standard input to count lines, words and characters (bytes) in that order:
|
|
|
|
|
|
|
|
`{{find .}} | wc`
|
2021-10-14 01:32:18 +08:00
|
|
|
|
|
|
|
- Count the length of the longest line in number of characters:
|
|
|
|
|
|
|
|
`wc --max-line-length {{file}}`
|