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. 2017 java期末上机练习

    仅供参考! 一.最大值.最小值.平均数 package examination; import java.util.Arrays; import java.util.Scanner; /** * 1. ...

  2. 20145211《网络对抗》注入Shellcode并执行&&Return-to-libc攻击

    Shellcode注入 基础知识 Shellcode实际是一段代码,但却作为数据发送给受攻击服务器,将代码存储到对方的堆栈中,并将堆栈的返回地址利用缓冲区溢出,覆盖成为指向 shellcode的地址. ...

  3. [微信开发] - 从最新的appid,appsecret读取配置信息

    设置好form表单,填写参数传入Java后端做为实例bean,接着存储倒数据库. 当微信端接口配置提交时,Java接口从数据库获取最新的配置信息,可以根据increaseID,也可以设置时间段, 这里 ...

  4. POJ 2195 Going Home(费用流)

    http://poj.org/problem?id=2195 题意: 在一个网格地图上,有n个小人和n栋房子.在每个时间单位内,每个小人可以往水平方向或垂直方向上移动一步,走到相邻的方格中.对每个小人 ...

  5. shell 输入不显示在监视器上

    #!/bin/bash read -s -p "Enter your password:" pass echo "your password is $pass" ...

  6. 安装基础版的kinetic

    没有gui工具 sudo apt-get install ros-kinetic-ros-base

  7. 查看nginx版本和安装的模块

    查看nginx版本 # nginx -v nginx version: nginx/1.12.2 查看nginx配置了哪些模块 # nginx -V nginx version: nginx/1.12 ...

  8. 解决本地项目推送到码云(github),上提示:failed to push some refs to ...

    本地项目上传github 命令如下: 1.git init 2.git add . 3.git commit  -m "init" 4.git remote add origin ...

  9. linux 环境下 eas console的运行

    1)访问 http://<HOST>:19000/easconsole/ 2)然后下载 jnlp 文件. 3)找个jre, 用javaws 运行 jnlp文件

  10. data模块

    这个模块原本应该存放Excel文件,提供utils目录下的config模块调用: 这里公司内部无法使用Excel读取数据,顾使用了ddt,其实里面就是.xslx文件