1.释义
计算文件的行数单词数字节数
2.系统帮助
用法:wc [选项]... [文件]... 或:wc [选项]... --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 打印字节计数 -m, --chars 打印字符计数 -l, --lines 打印行数 --files0-from=文件 从指定文件读取以NUL 终止的名称,如果该文件被 指定为"-"则从标准输入读文件名 -L, --max-line-length 显示最长行的长度 -w, --words 显示单词计数 --help 显示此帮助信息并退出 --version 显示版本信息并退出 GNU coreutils online help: <http://www.gnu.org/software/coreutils/> 请向<http://translationproject.org/team/zh_CN.html> 报告wc 的翻译错误 要获取完整文档,请运行:info coreutils 'wc invocation'
3.示例
3.1.默认
[root@itbkz.com s]#wc /etc/passwd 20 30 918 /etc/passwd
20
:行数
30
:单词数
918
:字节数
3.2.统计行总数
[root@itbkz.com s]#wc -l /etc/passwd 20 /etc/passwd
3.3.统计单词总数
[root@itbkz.com s]#wc -w /etc/passwd 30 /etc/passwd
3.4.统计字节总数
[root@itbkz.com s]#wc -c /etc/passwd 918 /etc/passwd
3.5.统计字符总数
[root@itbkz.com s]#wc -m /etc/passwd 918 /etc/passwd
3.6.统计最长行的长度
[root@itbkz.com s]#wc -L /etc/passwd 71 /etc/passwd