Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the wc command in linux

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to use the wc command in linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Full name

Wc is a tool for statistics, all spelled as: Word Count (word statistics)

Example:

1. Count rows

$wc-l file

two。 Count the number of words

$wc-w file

3. Statistical number of characters

$wc-c file

4. Count the number of characters in the stream

$echo-n 1234 | wc-c

Output: 4

Interpretation-- help

Usage: wc [option]. [file]. Or: wc [options]... -- files0-from=F prints the number of newline characters, words, and bytes per line, and if there is more than one file, the total number of lines per line. If there is no file, or if the file location is represented by a "-", the standard stream is read. A word is a non-zero-length sequence of characters separated by blank characters. The operations below may be used to select some type of print, usually in the order of newline characters, words, characters, bytes, maximum line length-c,-- bytes print bytes-m,-- chars print characters-l,-- lines print line feeds. That is, the total number of lines-the files0-from= file reads the name terminated by NUL from the specified file, if the file is specified as "-", the file name is read from the standard input-L,-- max-line-length displays the length of the longest line-w,-- words displays the word count-- help displays this help information and exits-- version displays version information and exits.

Interpretation:

1. More than one file

$wc file1 file2

Print the statistical lines of two files separately

2.-L

The number of characters that print the longest lines, that is, the length

3. Direct wc file without any parameters

The order is the number of lines, words, characters, bytes, maximum line length

Thank you for reading this article carefully. I hope the article "how to use wc commands in linux" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report