CentOS statistics command wc
Wc is a linux statistical command that collects statistics on the number of bytes, number of words, and number of rows in a specified file, and displays the statistical results.
Reprinted from: One linux Command every day (40): wc command
Command parameters:C. count the number of bytes. -L number of statistics rows. -M: The number of characters. This flag cannot be used with the-c flag. -W counts the number of words. A character is defined as a string separated by blank, Skip, or line breaks. -L print the maximum length of a row. -Help: Display help information -- version: display version information
Instance$ Wc access. log 217918 5997074 60703635 access. log $ wc-l access. log # the number of rows is 217993 access. log $ wc-c access. log #60755127 access. log $ wc-m access. log # access with 60755127 characters. log $ wc-w access. log # Word 6002544 access. log
Cat and wcIf you directly use the wc statistical file, the output result will contain a file name. Sometimes we don't need it, so we can use it together with cat for a long time.
$ Cat access. log | wc 218241 6008005 60807352 $ cat access. log | wc-l 218241