RHEL6基础三十五之服务器维护基础命令⑤wc

wc---Word Count

格式:wc [-选项] filename

功能:统计指定文件中的行数、字数、字节数,并将统计结果显示输出。

选项:

默认统计行数、字数、字节数三项,结果中不出现文件名通过管道实现

[root@justin ~]# cat /home/passwd
It is not only good to our health, but also to the environment.
There is no CO2 being produced as there are in cars. So it is very clean and green.
If you go to work by a bicycle instead of driving, you will get a better chance to get enough exercise.
[root@justin ~]# cat /home/passwd|wc
      3      52     253
[root@justin ~]#
-l  :统计行数;

[root@justin ~]# cat /home/passwd|wc -l
3
[root@justin ~]#
-w  :统计字数。一个字被定义为由空白、跳格或换行字符分隔的字符串;
[root@justin ~]# cat /home/passwd|wc -w
52
[root@justin ~]#

-c 统计字节数;

[root@justin ~]# cat /home/passwd|wc -c
253
[root@justin ~]#

-m  :统计字符数。这个标志不能与 -c 标志一起使用;

[root@justin ~]# cat /home/passwd|wc -m
253
[root@justin ~]#

-L 打印最长行的长度;

[root@justin ~]# cat /home/passwd|wc -L
104
[root@justin ~]#


你可能感兴趣的:(wc,RHEL6,服务器维护基础命令)