One day a shell command Linux text Operation series-WC command detailed _linux Shell

Source: Internet
Author: User

Name

WC is a tool for statistics, all spelled as: Word count (Word statistics)

Instance:

1. Statistics of rows

$WC –l File

2. Statistics of words

$WC –w File

3. Statistics of characters

$WC –c File

4. Number of characters in the statistical stream

$echo –n 1234 | Wc–c

Output: 4

Interpreting--help

Usage: WC [options] ... [File] ... 
Or: WC [options] ...--files0-from=f 
print line breaks, words, number of bytes per line, and if more than one file, print each total number of rows. If there are no files, or if the file location is represented by "-", then the standard stream is read. A word is a sequence of 0 long characters separated by whitespace. 
   The following actions may be used to select a certain type of print, usually in the order of line breaks, words, characters, bytes, maximum line length- 
c,--bytes          print bytes-
m,--chars         print the number of characters
-L,  --lines          print line breaks, that is, the total number of rows
--files0-from= files   read from the specified file to nul terminated names if the file is 
 specified as "-" Read the file name from standard input- 
L,--max-line-length displays the  length of the longest line- 
W,--words         Displays the word count 
              --help displays this help information and exits 
               - Version displays release information and exits

Interpretation:

1. More than one document

$WC file1 file2

Print a separate number of statistics lines for two files

2.–l

Print the longest number of characters in the line, that is, the length

3. Direct WC file, without any parameters

Order is line number, Word, character, Byte, maximum line length

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.