当前位置:网站首页>Basic use of shell WC (counting the number of characters)
Basic use of shell WC (counting the number of characters)
2022-04-23 04:31:00 【The hunter is eating meat】
wc
The function of the command is to count the number of bytes in the specified file 、 Number of words 、 Row number , And display the statistical results .
grammar
Basic grammar :
wc [ Options ] file name
Meaning of options :
Option parameters | meaning |
---|---|
-l |
Statistics Row number |
-m |
Statistics Number of characters |
-w |
Statistics Number of words |
-c |
Statistics Number of bytes |
Example :
wc1.txt The contents are as follows :
1 2
34 5
Hello
Yes wc1.tx Make statistics , The results are as follows :
[java@localhost java_demo]$ wc -l wc1.txt
3 wc1.txt
[java@localhost java_demo]$ wc -m wc1.txt
12 wc1.txt
[java@localhost java_demo]$ wc -w wc1.txt
5 wc1.txt
[java@localhost java_demo]$ wc -c wc1.txt
16 wc1.txt
The newline character at the end of each line is also a character ,1 A space counts 1 Characters .
(1) -l
Statistics Row number .
This simple , skip .
(2) -m
Statistics Number of characters
1 A Chinese character is used as 1 Character count , The result is 4 + 5 + 3 = 12 .
(3) -w
Statistics Number of words .
1 One word is 1 individual word.
The first 1 That's ok ,2 A word ;
The first 2 That's ok ,34
It means a word , common 2 A word ,
The first 3 That's ok , Hello
It means a word , therefore ,2+2+1=5.
(4) -c
Statistics Number of bytes
use UTF-8 code , A Chinese character is converted here 3 byte ,
The first 1 Line is 4 Bytes ,
The first 2 Line is 5 Bytes ,
The first 3 Line is 7 Bytes ,
The result is 4+5+7=16 .
wc -c
The result is 16 .
版权声明
本文为[The hunter is eating meat]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230417436518.html
边栏推荐
- 优麒麟 22.04 LTS 版本正式发布 | UKUI 3.1开启全新体验
- 电钻、电锤、电镐的区别
- Operating skills of spot gold_ Wave estimation curve
- [BIM introduction practice] wall hierarchy and FAQ in Revit
- Summary of Android development posts I interviewed in those years (attached test questions + answer analysis)
- Common string processing functions in C language
- 指纹Key全国产化电子元件推荐方案
- IEEE Transactions on Industrial Informatics(TII)投稿须知
- Chlamydia infection -- causes, symptoms, treatment and Prevention
- 1个需求的一生,团队协作在云效钉钉小程序上可以这么玩
猜你喜欢
/etc/bash_completion.d目录作用(用户登录立刻执行该目录下脚本)
Matlab reads multiple fig graphs and then combines them into one graph (in the form of sub graph)
[echart] démarrer avec echart
229. 求众数 II
[AI vision · quick review of today's sound acoustic papers, issue 2] Fri, 15 APR 2022
Summary of Android development posts I interviewed in those years (attached test questions + answer analysis)
Chapter 4 - understanding standard equipment documents, filters and pipelines
Qtspim manual - Chinese Translation
[AI vision · quick review of robot papers today, issue 32] wed, 20 APR 2022
[mapping program design] coordinate azimuth calculation artifact (version C)
随机推荐
The latest price trend chart and trading points of London Silver
Difference between LabVIEW small end sequence and large end sequence
【测绘程序设计】坐标反算神器V1.0(附C/C#/VB源程序)
io.Platform.packageRoot; // ignore: deprecated_member_use
[AI vision · quick review of robot papers today, issue 32] wed, 20 APR 2022
[echart] démarrer avec echart
单片机串口数据处理(2)——uCOSIII+循环队列接收数据
Understand the gut organ axis, good gut and good health
Mysql出现2013 Lost connection to MySQL server during query
Use recyclerview to realize left-right side-by-side classification selection
【BIM入门实战】Revit建筑墙体:构造、包络、叠层图文详解
【测绘程序设计】坐标方位角推算神器(C#版)
Cortex-M3寄存器组、汇编语言与C语言的接口介绍
为什么推荐你学嵌入式
Common string processing functions in C language
记录一下盲注脚本
在AWS控制台创建VPC(无图版)
Go反射—Go语言圣经学习笔记
上海航芯技术分享 | ACM32 MCU安全特性概述
C语言 字符常量