The WC is used for counting under Linux. Returns the number of rows, words, bytes, and so on in the file.
For example:
The code is as follows:
WC Wc1.txt
3 5 Wc1.txt
Output information in order: number of rows number of bytes file name. More specifically, a single statistic.
Copy Code
The code is as follows:
#wc-M FileName: Number of characters displayed for a file
#wc-L FileName: Displays the number of rows in a file
#wc-L FileName: Displays the length of the longest line in a file
#wc-W FileName: Displays the number of words in a file
Note: The seemingly WC statistics are determined by line breaks. This means that the last line has a newline character, the last WC row number is correct, otherwise there will be fewer lines.
To illustrate this issue, look at a Perl test:
The code is as follows:
Perl-e ' print ' a ' |WC
0 1 1
Perl-e ' print ' an ' |WC
1 1 2
In the example above, the Print command prints a, and if you do not have a newline character N, you don't think the line exists.
Description
1: A Chinese character for three bytes (unauthenticated, personally considered to be two bytes), a carriage return and other invisible characters also occupy a byte
2: At the end of a line if there is no carriage return, is not a row, that is, if a file has no newline at the end of the last line, the WC command counts fewer rows than the actual number of rows, and the actual number of rows is the number of rows you see, in fact, there is no carriage return, it does not count as a line ( Note: If in an existing text, the default is to have an invisible carriage return for all rows.