linux wc指令(wc命令)(Word count)(统计文件的字节数单词数行数等信息)
Posted Dontla
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux wc指令(wc命令)(Word count)(统计文件的字节数单词数行数等信息)相关的知识,希望对你有一定的参考价值。
文章目录
wc命令来自于英文词组“Word count”的缩写,其功能是用于统计文件的字节数、单词数、行数等信息,并将统计结果输出到终端界面。利用wc命令可以很快的计算出准确的单词数及行数,评估出文本的内容长度
[root@localhost files]# wc --help
Usage: wc [OPTION]... [FILE]...
or: wc [OPTION]... --files0-from=F
Print newline, word, and byte counts for each FILE, and a total line if
more than one FILE is specified. With no FILE, or when FILE is -,
read standard input. A word is a non-zero-length sequence of characters
delimited by white space.
The options below may be used to select which counts are printed, always in
the following order: newline, word, character, byte, maximum line length.
-c, --bytes print the byte counts
-m, --chars print the character counts
-l, --lines print the newline counts
--files0-from=F read input from the files specified by
NUL-terminated names in file F;
If F is - then read names from standard input
-L, --max-line-length print the length of the longest line
-w, --words print the word counts
--help display this help and exit
--version output version information and exit
GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'wc invocation'
[root@localhost files]#
示例
统计ls -l
的输出有多少行
[root@localhost files]# ls -l | wc -l
11
以上是关于linux wc指令(wc命令)(Word count)(统计文件的字节数单词数行数等信息)的主要内容,如果未能解决你的问题,请参考以下文章