Linux常用命令wc

wc名字来源: wc -- word, line, character, and byte count

The wc utility displays the number of lines, words, and bytes contained in each input file, or standard input (if no file
is specified) to the standard output. A line is defined as a string of characters delimited by a character.
Characters beyond the final character will not be included in the line count.

引用Linux中关于wc命令的描述:

wc用来显示标准输入或者输入的文件的行、单词、字节个数。被换行符分割即是一行。超出最最终换行符的字符不能算一行(即没有最终的换行符的将不算是一行)。

注:一定要注意这点,我在统计文件行数和表中行数时忽略了这点,排查了好一会。

一.语法

wc [-clmw] [file ...]

二.参数

-c:统计输入文件的字节个数,并将统计结果写道到标准输出;
-l:统计输入文件的行数,并将统计结果写到标准输出;
-m:统计字符个数,并将统计结果写到标准输出。目前不支持多字节的字符统计;
-w:统计单词个数,并将统计结果写到标准输出

原文地址:https://www.cnblogs.com/lxyit/p/9418011.html