与 unix 中的命令 wc -l 和 wc 混淆

Confuse with the command wc -l and wc in unix

file.txt中包含

Good is good
Bad
Gp
TR

什么我运行命令

wc file.txt 

它产生4 6 23.......我还是不太明白4 6 23是怎么来的?

另外当我运行命令

wc -l file.txt

它产生 4,表示文件中的行数。我说得对吗?

it produces 4 6 23..........I still don't quite understand how do 4 6 23 arrive?

意思是:

  • 4表示完整的有4行Input_file.
  • 6表示完整的有6个词Input_file.
  • 23 告诉我们整个文件中有 23 个字符。

所以只有当我们没有将任何选项传递给 wc 时才会出现此输出,如果您需要非常具体地获取这些详细信息,请使用类似的内容:wc -l 获取行和 wc -c 获取 Input_file.

中的字符数

来自 man wc:

DESCRIPTION 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.