Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
社区首页 >专栏 >wc 命令使用说明

wc 命令使用说明

作者头像
西湖醋鱼
发布于 2020-12-30 08:37:40
发布于 2020-12-30 08:37:40
56400
代码可运行
举报
运行总次数:0
代码可运行

wc 命令 使用说明

wc 命令还是很是简单的,通过 man 命令,可以见到可以选择的选项:

wc option file 

并且 wc 命令支持 管道操作

其中较为常用的命令选项

-c 字符的个数

-l 文件的行数

-w 单词的个数

小例子:

代码语言:javascript
代码运行次数:0
复制
~ wc -l /etc/passwd
47 /etc/passwd
➜  ~ wc -c /etc/passwd
2549 /etc/passwd
➜  ~ wc -w /etc/passwd
104 /etc/passwd
➜  ~ 

Man 手册,具体内容很简短,有时间大家还是多阅读英文手册。

代码语言:javascript
代码运行次数:0
复制
NAME
       wc - print newline, word, and byte counts for each file

SYNOPSIS
       wc [OPTION]... [FILE]...
       wc [OPTION]... --files0-from=F

DESCRIPTION
       Print  newline, word, and byte counts for each FILE, and a total line if more than one FILE is specified.  A word is a non-zero-length sequence of char‐
       acters delimited by white space.

       With no FILE, or when FILE is -, read standard input.

       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=F
              read input from the files specified by NUL-terminated names in file F; If F is - then read names from standard input

       -L, --max-line-length
              print the maximum display width

       -w, --words
              print the word counts

       --help display this help and exit

       --version
              output version information and exit

保持更新,更多内容请关注cnblogs.com/xuyaowen;

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-07-22 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
linux中计算行数,字数,字符数的10个wc命令示例
wc命令的功能为统计指定文件中的字节数、字数、行数, 并将统计结果显示输出。 # wc [options] filenames 以下是该命令提供的选项和用法。 -c, --bytes 输出目标文件中字节的计数结果 -m, --chars 输出目标文件的中字符的计数结果 -l, --lines 输出目标文件中 行 的计数结果 --files0-from=F 从NUL-terminated指明的名字在文件F中的文件中读取,如
入门笔记
2022/06/02
9220
[Linux][4_文件,打包和用户管理]
Linux系统中使用以下命令来查看文件的内容:     cat 由第一行开始显示文件内容     tac 从最后一行开始显示,可以看出 tac 是 cat 的倒著写!     nl 显示的时候,顺道输出行号!     more 一页一页的显示文件内容     less 与 more 类似,但是比 more 更好的是,他可以往前翻页!     head 只看头几行     tail 只看尾巴几行     wc 统计文件行数
玖柒的小窝
2021/10/23
5550
Linux命令(12)——wc命令
(3)从文件读取输入文件名。如果有多个文件名,并且希望 wc 从一个文件中读取它们,那么使用-files0-from 选项。这里将文件名称必须以NULL字符结束写在文件fileNames.txt中。
恋喵大鲤鱼
2018/08/03
1.7K0
LinuxShell命令wc
wc 命令用来统计每个文件的行、单词和字节数并输出。如果指定多个文件,则输出每个文件的总行\单词\字节数及所有文件总的行\单词\字节数;如果没有指定文件或指定文件为 - ,则从标准输入读取。
hotarugali
2022/02/28
4470
sort命令
Linux sort 命令用于将文本文件内容加以排序,可针对文本文件的内容,以行为单位来排序(默认以ASCII编码作比较)。
cultureSun
2023/05/18
6090
一天一个 Linux 命令(25):du 命令
本文为joshua317原创文章,转载请注明:转载自joshua317博客 https://www.joshua317.com/article/160
joshua317
2021/10/18
7420
Linux-sort排序
sort命令是在Linux里非常有用,它将文件进行排序,并将排序结果标准输出。sort命令既可以从特定的文件,也可以从stdin中获取输入。
小小工匠
2021/08/16
2.5K0
一天一个 Linux 命令(19):grep 命令
本文为joshua317原创文章,转载请注明:转载自joshua317博客 https://www.joshua317.com/article/148
joshua317
2021/09/29
4270
Linux常用命令
1:  shutdown [root@cairui ~]# shutdown --help Usage: shutdown [OPTION]... TIME [MESSAGE]  #使用 Bring the system down. Options: -r reboot after shutdown            #重启,也可以直接使用 reboot 命令 -h halt or power
用户1173509
2022/05/09
7530
Linux常用命令
Linux 学习笔记之超详细基础linux命令 Part 2
---------------------------------接Part 1------------------------------
授客
2019/09/12
5210
Linux系统之grep命令基本使用
江湖有缘
2023/11/29
3020
String
Strings C-style strings have a special feature:The last character of every string is the null character .Consider the following two declarations: char dog[8] = {'b','e','a','u','x',' ','I','I'};// not a string char cat[8] = {'f','a','t','e','s','s','a','\0
青木
2018/05/28
6990
三大文本处理工具grep、sed及awk
  grep能够接受正则表达式,生成各种格式的输出。除此之外,它还有大量有趣的选项。
用户1173509
2022/05/09
6880
三大文本处理工具grep、sed及awk
【笔记归档】shell学习笔记
1.3 登录shell or --login (交互式,非交互) /etc/profile, ~/.bash_profile, ~/bash_login, ~/.profile (~/.bash_logout, 退出时)
fankhu
2021/08/06
1.5K0
如何在 Linux下优雅的进行大文件切割与合并
往往是因为网络传输的限制,导致很多时候,我们需要在 Linux 系统下进行大文件的切割。这样将一个大文件切割成为多个小文件,进行传输,传输完毕之后进行合并即可。 1. 文件切割 - split 在 Linux 系统下使用 split 命令进行大文件切割很方便 [1] 命令语法 # -a: 指定输出文件名的后缀长度(默认为2个:aa,ab...) # -d: 指定输出文件名的后缀用数字代替 # -l: 行数分割模式(指定每多少行切成一个小文件;默认行数是1000行) # -b: 二进制分割模式(支持单位:k/
iMike
2021/07/01
3.8K0
linux 命令英文全称
su:Swith user  切换用户,切换到root用户 cat: Concatenate  串联 uname: Unix name  系统名称 df: Disk free  空余硬盘 du: Disk usage 硬盘使用率 chown: Change owner 改变所有者 chgrp: Change group 改变用户组 ps:Process Status  进程状态 tar:Tape archive 解压文件 chmod: Change mode 改变模式 umount:
幽鸿
2020/04/02
3.8K0
第七章:重定向
In this lesson we are going to unleash what may be the coolest feature of the commandline. It’s called I/O redirection. The “I/O” stands for input/output and with this facilityyou can redirect the input and output of commands to and from files, as well as connectmultiple commands together into powerful command pipelines. To show off this facility,we will introduce the following commands:
砖业洋__
2023/05/06
1870
在线matlab代码学习神器Octave Online
Octave与MATLAB完全兼容,免安装使用方便。注册和非注册功能会有不同,如下:
zhangrelay
2019/01/23
6.6K0
第二十九章 : 读取键盘输入
The scripts we have written so far lack a feature common in most computer programs —interactivity. That is, the ability of the program to interact with the user. While manyprograms don’t need to be interactive, some programs benefit from being able to acceptinput directly from the user. Take, for example, this script from the previous chapter:
砖业洋__
2023/05/06
3300
第十八章 : 查找文件
查找文件 As we have wandered around our Linux system, one thing has become abundantly clear:a typical Li
砖业洋__
2023/05/06
2760
相关推荐
linux中计算行数,字数,字符数的10个wc命令示例
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
查看详情【社区公告】 技术创作特训营有奖征文
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验