A linux command-WC command per day

Source: Internet
Author: User

Syntax: WC [options] File ...

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

The command options have the following meanings:

-C Count bytes.

-L COUNT the number of rows.

-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 at most one column per item.

Number of rows, words, bytes, filenames

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

For example:

$ wc - lcw file1 file2
4 33 file1
7 52 file2
11 11 85 total

Example Analysis:

1. Count the number of JS files in the demo directory:

Find demo/-name "*.js" |wc-l

2. Statistics of all JS file code lines in the demo directory:

Find demo/-name "*.js" |xargs cat|wc-l or Wc-l ' find./-name ' *.js ' |tail-n1

3. Statistics of all JS file code lines in the demo directory, Filtered Blank lines:

Find/demo-name "*.js" |xargs cat|grep-v ^$|wc-l

A linux command-WC command per day

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.