View file content statistics by CentOS command-wc

Source: Internet
Author: User
The wc (WordCount) command is used to count the file content information, including the number of lines and characters. [python] viewplaincopy # displays the file content information. the output information is the number of lines, number of words, and number of bytes in sequence, file name wcfilename # display the number of lines of a file wc-lfilename # display the number of bytes of a file wc-cfilename # display the number of characters of a file wc-mfilename &

The wc (Word Count) command is used to Count the file content, including the number of lines and characters.

[Python]View plaincopy
  1. # Display file content information. the output information is the number of lines, number of words, number of bytes, and file name.

  2. Wc filename

  3. # Display the number of lines of a file

  4. Wc-l filename

  5. # Display the number of bytes of a file

  6. Wc-c filename

  7. # Display the characters of a file

  8. Wc-m filename

  9. # Display the length of the longest row in a file

  10. Wc-L filename

  11. # Note: the line break at the end of each line is also considered a character, and a space is also considered a character

  12. # Using UTF-8 encoding, so a Chinese character is converted to 3 bytes here

  13. # When the-m option is used, a Chinese character is calculated as a character


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.