Linux WC print line break, Word and byte count

Source: Internet
Author: User
Tags log log

WC prints line breaks, word and byte counts, and supports multiple file printing, command format:


WC [OPTION] ... [FILE] ...

Or

WC [OPTION] ...--files0-from=f


Common ways:

    1. View Error.log Log Total rows

      Wc-l Error.log
    2. View the total number of Error.log log bytes

      Wc-c Error.log
    3. View the number of file lines for the Error.* class in the log directory

      Wc-l log/error.*



Parameter list:


-C,--bytes

Description: Total bytes of printed files


-M,--chars

Description: The total number of characters in the printed file


-L,--lines

Description: Total number of rows in the printed file


--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

Description: Print batch To specify some files, bytes, lines, characters, and other information.

When F is a file name, the specified file name is read (the contents of the file being read should be the specified list of file names, and the ^@ special symbol is appended to the end of each file name, Note: This symbol is not ^ with @ but press CTRL + V and then enter 10 and then press the other key to see the type ^@ Blue symbol). Such as:

File TEST.WC content:

sh.log^ @test. sh^@

Command:

WC--FILES0-FROM=TEST.WC

Results:

[[email protected] ~]# WC--files0-from=test.txt 460275 1332379 40275303 sh.log 9 338 TEST.SHWC:: N o such file or directory 460284 1332404 40275641 Total

When F is-it means receiving standard input reads, general use | Pipe input to WC, e.g.:

Find. -name ' *.log '-print0 |WC--files0-from=-

You can also use the command tearful related instructions:

Info WC


-L,--max-line-length

Description: The maximum number of lines in a file to print


-W,--words

Description: Print the number of words in a file


--help

Description: Display Help information


--version

Description: Print the current command version information


This article is from the "gangbusters" blog, make sure to keep this source http://php2012web.blog.51cto.com/5585213/1672524

Linux WC print line break, Word and byte count

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.