WCCommandTo count the number of bytes, number of words, and number of rows in a specified file, and display the statistical results.
Syntax: WC [Option] file...
Note: This command counts the number of bytes, number of words, and number of lines in a given file. If no file name is provided, it is read from the standard input. WC also provides the President count for all specified files. Is the largest string separated by space characters.
The options of this command are as follows:
-C: counts the number of bytes.
-L number of statistics 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. It is always displayed in the following order and each item has at most one column.
Number of lines, number of words, number of bytes, and file name
If there is no file name in the command line, no file name appears in the output.
For example:
$ WC-LCWFile1 file2
4 33 file1
7 52 file2
11 11 85 total
If any option is omitted-LCW, the WC command execution result is the same as the preceding one.
Example:
The WC command is used to calculate the number of lines, words, and characters in a file or multiple specified files. For example:
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 optional parameters: l, C, M, W
WC-l filename report row count
WC-C filename report Byte Count
WC-M filename report characters
WC-W filename
The command shown today is:Ls-L | WC-L is used to count the number of files in the current directory.