wc指令比较实用,可以统计文件中的字节数、字符数、行数、字数等。

先通过 wc --help 查看指令帮助。

$ wc --help
Usage: wc [OPTION]... [FILE]...
or: wc [OPTION]... --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=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 length of the longest line
-w, --words print the word counts
--help display this help and exit
--version output version information and exit Report wc bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'wc invocation'

格式:wc [option] ... [file]

$ cat .txt 

mn

xyz

-c 或者 -bytes:打印文件字节数

$ wc -c .txt
.txt

-m 或者 --chars:打印文件字符数

$ wc -m .txt
.txt

-l 或者 --lines:打印文件行数

$ wc -l .txt
.txt

-L 或者 --max-line-length:打印最长一行的长度

$ wc -L .txt
.txt

-w 或者 --words:打印字数

$ wc -w .txt
.txt

--help:查看指令帮助并退出

--version:输出版本信息并退出

$ wc --version
wc (GNU coreutils) 8.21
Copyright (C) Free Software Foundation, Inc.
License GPLv3+: GNU GPL version or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Written by Paul Rubin and David MacKenzie.

Linux wc指令解析的更多相关文章

  1. Linux进阶指令(重点)

    三.Linux进阶指令(重点) 1.df指令    作用:查看磁盘的空间 #df -h 选项:-h    表示以可读性较高的形式展示大小 2.free指令     作用:查看内存使用情况 #free ...

  2. Linux常用指令【转载】

    [收藏]Linux常用指令[转载] $ 命令行提示符 粗体表示命令 斜体表示参数 filename, file1, file2 都是文件名.有时文件名有后缀,比如file.zip command 命令 ...

  3. 【ZZ】Linux常用指令

    linux常用指令 - 个人文章 - SegmentFault 思否 https://segmentfault.com/a/1190000011068772 查看目录下有什么文件信息 ls //lis ...

  4. Linux常用指令大全

    2017-03-25   16:35:42 刚开始学习Linux,由于记忆力有限,把平时常用的Linux命令整理出来,以便随时查阅:  linux 基本命令    ls     (list 显示当前目 ...

  5. linux log日志解析

    linux log日志解析   其实,可以说成是监控系统的记录,系统一举一动基本会记录下来.这样由于信息非常全面很重要,通常只有 root 可以进行视察!通过登录文件(日志文件)可以根据屏幕上面的错误 ...

  6. Linux常用指令(三)

    进入京东运维组实习,收到了很多同事的热心指导,自己也努力学习,按照他们给出的学习计划,真的很充实,学到了很多不只是开发方面的知识. 以下简单记录下自己的笔记,方便以后查阅. 1.文件系统 Linux系 ...

  7. Linux 基础指令初识

    Linux 基础指令初识 01. ls 指令 语法: ls [选项] [目录或文件] 功能:对于目录,该命令列出该目录下的所有子目录与文件.对于文件,将列出文件名以及其他信息 -a 列出目录下的所有文 ...

  8. linux常用指令

    整理下来的linux常用指令 mount [-t 文件系统] 设备文件名 挂载点挂载命令,一般用于在挂载ISO,或者其他比如U盘等设备时使用,[-t iso9660]为固定格式,可写可不写,非必写项. ...

  9. Linux Pthread 深入解析(转-度娘818)

    Linux Pthread 深入解析   Outline - 1.线程特点 - 2.pthread创建 - 3.pthread终止         - 4.mutex互斥量使用框架         - ...

随机推荐

  1. sqlite的时间筛选字段

    唉,需要不停的踩坑呀 commandText = commandText + string.Format("where [CollectDateTime] <'{0}' and [Co ...

  2. 【查看内存】Linux查看内存使用情况(一)

    用 'top -i' 看看有多少进程处于 Running 状态,可能系统存在内存或 I/O 瓶颈,用 free 看看系统内存使用情况,swap 是否被占用很多,用 iostat 看看 I/O 负载情况 ...

  3. 前端工程化 - bower

    什么是bower bower是前端的包管理工具,类似于php的composer,python的pip,虽然先如今bower已经停止了更新(主要是因为Browserify和Webpack等包管理工具的兴 ...

  4. VS2012 QT程序打包部署详解

    1.设置安装程序集 InstallShield安装完成后,执行以下步骤右键解决方案-->添加-->新建项目-->其他项目类型-->安装和部署,具体操作如下图: 2.发布程序 在 ...

  5. Observer(观察者)

    意图: 定义对象间的一种一对多的依赖关系,当一个对象的状态发生改变时, 所有依赖于它的对象都得到通知并被自动更新. 适用性: 当一个抽象模型有两个方面, 其中一个方面依赖于另一方面.将这二者封装在独立 ...

  6. [原][osgearth]osgearthElvation中的一帧

    create tile key contains 获取tile上的临界值 这里先获取层数的切份(下图) 然后使用xmin,xmax,ymin,ymax获取tile的四个点 再通过geoextent获取 ...

  7. SpringBoot在启动时的多环境配置以及加载顺序

    通常我们在开发完成一个SpringBoot项目时,总是要打包部署的. 在启动SpringBoot应用时,我们常常会使用命令java -jar xxx.jar来启动这个服务. 命令java -jar 除 ...

  8. 【整理】STL中的bitset(二进制华丽解决假五维偏序题)

    ------------更多Bitset的运用,请看这里http://www.cnblogs.com/hua-dong/p/8519739.html. 由于在学cdq分治,看到了这道题.先来看一道题目 ...

  9. uva11149矩阵快速幂

    求A+A^1+...+A^n 转换一下变成|A  E|,的n+1次方就是|A^(n+1)  A^n+...+A+E| |0  E|                       |    0       ...

  10. OATable中column栏位数据居中的实现方法及代码

    // Table column中显示居中的实现 // QpriceResultTable1 为table的名称 // noPrice 为table中的列 OATableBean table = (OA ...