wc 命令使用說明


wc 命令 使用說明

wc 命令還是很是簡單的,通過 man 命令,可以見到可以選擇的選項:

 

wc option file 

並且 wc 命令支持 管道操作

其中較為常用的命令選項

-c 字符的個數

-l 文件的行數

-w 單詞的個數

 

小例子:

➜  ~ wc -l /etc/passwd
47 /etc/passwd~ wc -c /etc/passwd
2549 /etc/passwd~ wc -w /etc/passwd
104 /etc/passwd~ 

Man 手冊,具體內容很簡短,有時間大家還是多閱讀英文手冊。

NAME
       wc - print newline, word, and byte counts for each file

SYNOPSIS
       wc [OPTION]... [FILE]...
       wc [OPTION]... --files0-from=F

DESCRIPTION
       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 char‐
       acters delimited by white space.

       With no FILE, or when FILE is -, read standard input.

       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 display this help and exit

       --version
              output version information and exit

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM