[英]Confuse with the command wc -l and wc in unix
In the file.txt , it contains在file.txt 中,它包含
Good is good
Bad
Gp
TR
What I run the command我运行的命令
wc file.txt
it produces 4 6 23..........I still don't quite understand how do 4 6 23 arrive?它产生 4 6 23 ........ 我还是不太明白 4 6 23 是如何到达的?
Also when I run the command另外当我运行命令时
wc -l file.txt
it produces 4 which means the number of rows in the file..Am I right?它产生 4,这意味着文件中的行数..我说得对吗?
it produces 4 6 23..........I still don't quite understand how do 4 6 23 arrive?
它产生 4 6 23 ........ 我还是不太明白 4 6 23 是如何到达的?
It means:它的意思是:
4
denotes that there are 4 lines in complete Input_file. 4
表示完整的 Input_file 有 4 行。6
denotes that there are 6 words in complete Input_file. 6
表示完整的Input_file中有6个字。23
tells us that there are 23 characters present in whole file. 23
告诉我们整个文件中有 23 个字符。 So this output only comes when we do not pass any option to wc
, in case you need to get these details very specifically then use something like: wc -l
to get lines and wc -c
to get number of characters in Input_file.因此,此输出仅在我们不向
wc
传递任何选项时才会出现,如果您需要非常具体地获取这些详细信息,请使用以下内容: wc -l
获取行, wc -c
获取 Input_file 中的字符数。
From man wc
:来自
man wc
:
DESCRIPTION Print newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified.
描述 打印每个 FILE 的换行符、字和字节计数,如果指定了多个 FILE,则打印总行。 With no FILE, or when FILE is -, read standard input.
没有 FILE 或 FILE 为 - 时,读取标准输入。 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.
以下选项可用于选择打印哪些计数,始终按以下顺序排列:换行符、单词、字符、字节、最大行长度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.