Linux WC command parameters and usage detailed

Source: Internet
Author: User

The function of the WC command is to count the number of bytes, words, and rows in the specified file and display the results to the output.

Syntax: WC [options] File ...

Description: This command counts the number of bytes, words, and lines in a given file. If no file name is given, read from standard input. The WC gives also the president count of all specified documents at the same time. A word is the largest string that is separated by a space character area.

The options for this command have the following meanings:

-C Statistics the number of bytes.

-L statistic line count.

-W counts the number of words.

These options can be used in combination.

The order and number of output columns are not affected by the order and number of options. Always appear in the following order and each item is at most one column.

Number of lines, words, bytes, file names

If there is no file name on the command line, the file name does not appear in the output.

For example:

$ WC-LCW file1 file2

4 file1

7 File2

Total

Omit option-LCW,WC command has the same execution result as above

Example:

The WC command is used to compute the number of lines, words, and characters in a file or in a specified number of files. Such as:

WC filename

The first column shows the number of rows, the second column shows the number of words, and the third column shows the number of characters.

WC has four parameters to choose from, namely L,c,m,w

Wc-l FileName Report Line number

wc-c FileName Report byte number

WC-M FileName Report character number

WC-W FileName Report Word number

The command you see today is: Ls-l|wc-l to count the number of files in the current directory

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.