2013-12-25 11:17:18 +00:00
|
|
|
# wc
|
|
|
|
|
2019-11-14 16:58:45 +00:00
|
|
|
> Count lines, words, or bytes.
|
2021-04-01 16:54:26 +01:00
|
|
|
> More information: <https://www.gnu.org/software/coreutils/wc>.
|
2013-12-25 11:17:18 +00:00
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Count lines in file:
|
2013-12-25 11:17:18 +00:00
|
|
|
|
|
|
|
`wc -l {{file}}`
|
|
|
|
|
2016-02-10 17:46:05 +00:00
|
|
|
- Count words in file:
|
|
|
|
|
|
|
|
`wc -w {{file}}`
|
|
|
|
|
|
|
|
- Count characters (bytes) in file:
|
2013-12-25 11:17:18 +00:00
|
|
|
|
|
|
|
`wc -c {{file}}`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Count characters in file (taking multi-byte character sets into account):
|
2013-12-25 11:17:18 +00:00
|
|
|
|
|
|
|
`wc -m {{file}}`
|
2020-05-29 12:01:37 +01:00
|
|
|
|
|
|
|
- Use standard input to count lines, words and characters (bytes) in that order:
|
|
|
|
|
|
|
|
`{{find .}} | wc`
|
2021-10-13 18:32:18 +01:00
|
|
|
|
|
|
|
- Count the length of the longest line in number of characters:
|
|
|
|
|
|
|
|
`wc --max-line-length {{file}}`
|