In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to use the wc command in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Linux commonly used command wc command counts the number of bytes, words and lines in the specified file, and displays the statistical results. Using the wc instruction, we can calculate the number of Byte, words, or columns of a file. If the file name is not specified, or if the file name is given as "-", the wc instruction will read data from the standard input device. Wc also gives the presidential count of the specified files, the following good tutorial network for you to share the common Linux command-wc command specific usage.
Wc counts the number of bytes, words and lines of a file
Syntax wc (option) (parameter) wc [option]... [file]. Wc [options]... -- files0-from=F option-c # counts bytes, or-- bytes or-- chars: displays only the number of Bytes;. -l # count rows, or-- lines: show only the number of columns; -m # counts the number of characters. This flag cannot be used with the-c flag. -w # word count, or-- words: displays only the word count. A word is defined as a string separated by white space, tabbed, or newline characters. -L # prints the length of the longest line. -help # displays help information-- version # displays version information parameter files: a list of files to be counted.
The example wc-l * # counts the number of lines of all files and the total number of lines in the current directory. Wc-l * .js # counts the number of file lines and total lines of all .js suffixes in the current directory. Find. * | xargs wc-l # all file lines and total lines in the current directory and subdirectories. View the number of bytes, words, and lines of a file
Wc test.txt # output result 7 8 70 test.txt # Line count word count byte File name how to print only statistics but not file name with wc command
Wc-l # output result 7 is used to count the number of files in the current directory (excluding hidden files)
# to remove TOTAL lines expr $(ls-l | wc-l)-1 # output result 8 count the number of lines and total lines of all files in the current directory
[root@centos7] # wc-l * 21 LICENSE 270README.md wc: example: read: Is a directory 785 lerna-debug.log 25 lerna.json wc: node_modules: read: Is a directory 23603 package-lock.json 79 package.json 3 renovate.json 24786 total thank you for reading! This is the end of this article on "how to use the wc command in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.