歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網

wc

日期:2017/3/3 13:00:50   编辑:Linux技術
wc命令的功能為統計指定文件中的字節數、字數、行數, 並將統計結果顯示輸出。
語法:wc [選項] 文件…
說明:該命令統計給定文件中的字節數、字數、行數。如果沒有給出文件名,則從標准輸入讀取。wc同時也給出所有指定文件的總統計數。字是由空格字符區分開的最大字符串。
該命令各選項含義如下:
-c 統計字節數。(byte)
-l 統計行數。(line)
-m 統計字符數。這個標志不能與 -c 標志一起使用。(character)
-w 統計字數。一個字被定義為由空白、跳格或換行字符分隔的字符串。(word)
-L 打印最長行的長度。
-help 顯示幫助信息
–version 顯示版本信息
這些選項可以組合使用。
輸出列的順序和數目不受選項的順序和數目的影響。總是按下述順序顯示並且每項最多一列。
行數、字數、字節數、文件名
如果命令行中沒有文件名,則輸出中不出現文件名。
/content/3656678.html
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.
[code] -c, --bytes
          print the byte counts

   -m, --chars
          print the character counts

   -l, --lines
          print the newline counts

   --files0-from=F
          read input from the files specified by NUL-terminated  names  in
          file F; If F is - then read names from standard input

   -L, --max-line-length
          print the length of the longest line

   -w, --words
          print the word counts

   --help display this help and exit

   --version
          output version information and exit
Copyright © Linux教程網 All Rights Reserved