Linux wc指令:檔案行數、字元數統計指令
[email protected]_u1604:~$ wc --help
用法:wc [選項]... [檔案]...
或:wc [選項]... --files0-from=F
Print newline, word, and byte counts for each FILE, and a total line if
more than one FILE is specified. 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.
-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 maximum display width
-w, --words print the word counts
--help 顯示此幫助資訊并退出
--version 顯示版本資訊并退出
[email protected]:~$ wc /home/wangyetao/Documents/blog.log # /home/wangyetao/Documents/blog.log檔案的統計資訊
5419 36948 305404 /home/wangyetao/Documents/blog.log # blog.log檔案的行數為5419、單詞數36948、位元組數305404
[email protected]_u1604:~$ wc .bashrc
123 532 3971 .bashrc//目前檔案byte數
[email protected]_u1604:~$ wc -c .bashrc
3971 .bashrc//目前檔案字元數
[email protected]_u1604:~$ wc -m .bashrc
3959 .bashrc
[email protected]_u1604:~$ wc -l .bashrc
123 .bashrc//目前檔案行數
[email protected]_u1604:~$ wc -L .bashrc
164 .bashrc
[email protected]_u1604:~$ wc -w .bashrc
532 .bashrc
[email protected]_u1604:~$