Linux命令解析--wc 最好用的统计命令

来源:互联网 发布:java读取文件 编辑:程序博客网 时间:2024/04/30 11:51
[root@DB104 ftp]# wc --help
Usage: wc [OPTION]... [FILE]...
用法: wc [参数]... [文件]...

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.
输出每个文件的行数、单词数、字节数;多个文件分别显示,统计总量。
例:
[root@DB104 ftp]# wc -l /etc/services /etc/aliases
10774 /etc/services
     96 /etc/aliases
10870 total

  -c, --bytes print the byte counts 统计字节总数;
例:
[root@DB104 ftp]# wc -c /etc/services 
641020 /etc/services

  -m, --chars print the character counts 统计字符串总数;
例:
[root@DB104 ftp]# wc -m /etc/services 
641016 /etc/services

  -l, --lines  print the newline counts 统计行数;
例:
[root@DB104 ftp]# wc -l /etc/services 
10774 /etc/services

  -L, --max-line-length  print the length of the longest line 统计最长的行长度;
例:
[root@DB104 ftp]# wc -L /etc/services 
130 /etc/services

  -w, --words  print the word counts 统计单词数;
例:
[root@DB104 ftp]# wc -w /etc/services 
58108 /etc/services
0 0
原创粉丝点击