当前位置: 首页 > news >正文

Linux命令 wc(word count)-l(lines)用于统计文件中的行数。

文章目录

  • 1、wc -l
  • 2、实战
  • 3、wc --help

1、wc -l

在命令 wc -l 中,-l 的英文全称是 lines。这个选项用于指定 wc(word count,单词计数)命令来统计文件的行数。

例如,当你运行 wc -l load_user_100w_sort.sql 时,wc 会计算 load_user_100w_sort.sql 文件中的行数,并输出结果。

2、实战

[root@localhost ~]# ll
总用量 56504
-rw-------. 1 root root     1533 124 2023 anaconda-ks.cfg
-rw-r--r--. 1 root root      191 625 13:29 dump6379.rdb
-rw-r--r--. 1 root root      191 625 13:31 dump6380.rdb
-rw-r--r--. 1 root root      191 625 13:32 dump6381.rdb
-rw-r--r--. 1 root root      583 624 11:13 dump.rdb
-rw-r--r--. 1 root root     1564 124 2023 initial-setup-ks.cfg
-rw-r--r--. 1 root root 57650380 222 2022 load_user_100w_sort.sql
drwxr-xr-x. 3 root root       18 18 18:11 minio
-rw-r--r--. 1 root root      141 625 17:00 nodes-6379.conf
-rw-------. 1 root root   178567 63 13:50 nohup.out
drwxr-xr-x. 2 root root        6 124 2023 公共
drwxr-xr-x. 2 root root        6 124 2023 模板
drwxr-xr-x. 2 root root        6 124 2023 视频
drwxr-xr-x. 2 root root        6 124 2023 图片
drwxr-xr-x. 2 root root        6 124 2023 文档
drwxr-xr-x. 2 root root        6 124 2023 下载
drwxr-xr-x. 2 root root        6 124 2023 音乐
drwxr-xr-x. 2 root root        6 124 2023 桌面
[root@localhost ~]# wc -l load_user_100w_sort.sql 
1000000 load_user_100w_sort.sql
[root@localhost ~]# 

这表示 load_user_100w_sort.sql 文件中有 1,000,000 行(假设文件名中的 "100w" 是 "100万" 的缩写,即一百万)

3、wc --help

[root@localhost ~]# wc --help
用法:wc [选项]... [文件]...或:wc [选项]... --files0-from=F
Print newline, word, and byte counts for each FILE, and a total line if
more than one FILE is specified.  With no FILE, or when FILE is -,
read standard input.  A word is a non-zero-length sequence of characters
delimited by white space.
The options below may be used to select which counts are printed, always in
the following order: newline, word, character, byte, maximum line length.-c, --bytes            print the byte counts-m, --chars            print the character counts-l, --lines            print the newline counts--files0-from=文件        从指定文件读取以NUL 终止的名称,如果该文件被指定为"-"则从标准输入读文件名-L, --max-line-length 显示最长行的长度-w, --words                   显示单词计数--help            显示此帮助信息并退出--version         显示版本信息并退出GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
请向<http://translationproject.org/team/zh_CN.html> 报告wc 的翻译错误
要获取完整文档,请运行:info coreutils 'wc invocation'
[root@localhost ~]# 

在这里插入图片描述

http://www.lryc.cn/news/388748.html

相关文章:

  • 数据结构 - C/C++ - 链表
  • sheng的学习笔记-AI-高斯混合模型(GMM)
  • OFDM的缺点与关键技术
  • 电脑录音软件哪个好?7款录制音频工具大盘点,赶快学起来!(2024)
  • 【Android面试八股文】你说你使用Leakcanary进行内存泄漏检测,那你能说一说Leakcanary的原理吗?
  • 蒂升电梯职业性格和Verify认知能力SHL测评答题攻略及薪资待遇解密!
  • window上部署sql server改动端口、和sqlserver的一些还原、批量插入存储过程的命令
  • 【单片机与嵌入式】stm32串口通信入门
  • 启动Redis服务器
  • uniapp中使用threejs加载几何体
  • 【SQL注入】 数据库基础
  • 文件操作~
  • 身边的故事(十二):阿文的故事:消失
  • 智能扫地机器人程序中出现的问题可以参考的解决方案
  • 如何借用物联网快速实现高标准农田信息化
  • 计算机网络基础入门
  • uniApp vue2 vue3配置代理
  • 运维锅总详解RocketMQ
  • 【Linux】使用ntp同步时间
  • 【FedMut】Generalized Federated Learning via Stochastic Mutation
  • 在线教育项目(一):如何防止一个账号多个地方登陆
  • 旋转变压器软件解码simulink仿真
  • LeetCode 1321, 209, 102
  • vant ( weapp ) - - - - - van-tabs组件选中下划线初始位置异常
  • 007 栈(lua)
  • SQL中Order by详解
  • 【git】存在git LFS文件时如何处理
  • 面向阿克曼移动机器人(自行车模型)的LQR(最优二次型调节器)路径跟踪方法
  • 【运维】在 Docker 容器中指定 UTF-8 编码:方法与技巧
  • primetime中cell和net的OCV