Counting Lines, Words, and Characters with wc  

When working with text files, you sometimes get a large amount of output. Before deciding which approach works best in a specific case, you might want to have an idea about the amount of text you are dealing with. In that case, the  wc  command is useful. In its output, this command gives three different results: the number of lines, the number of words, and the number of characters.

[root@rhel7 ~]# 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 GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'wc invocation'
[root@rhel7 ~]# cat wctest |wc -w [root@rhel7 ~]# cat wctest | wc -l [root@rhel7 ~]# cat wctest |wc -c [root@rhel7 ~]# cat wctest |wc -m [root@rhel7 ~]# cat wctest |wc -L [root@rhel7 ~]#

Counting Lines, Words, and Characters with wc的更多相关文章

  1. Linux shell basic3 dd wc comm chmod ls

    Generating files of any size /dev/zerois a character special device, which infinitely returns the ze ...

  2. Codeforces Round #219 (Div. 2) D. Counting Rectangles is Fun 四维前缀和

    D. Counting Rectangles is Fun time limit per test 4 seconds memory limit per test 256 megabytes inpu ...

  3. sed正则表达式

    sed的正则匹配如何实现非贪婪? sed的正则用的是BREs/EREs,不支持非贪婪模式.当然有一些方法可以实现非贪婪,比如: $ echo abcOabcdOabc | sed 's/.*O//' ...

  4. sed武功心法(info sed翻译+注解)

    本文中的提到GNU扩展时,表示该功能是GNU为sed提供的(即GNU版本的sed才有该功能),一般此时都会说明:如果要写具有可移植性的脚本,应尽量避免在脚本中使用该选项. 本文中的正则表达式几乎和gr ...

  5. sed修炼系列(二):sed武功心法(info sed翻译+注解)

    sed系列文章: sed修炼系列(一):花拳绣腿之入门篇sed修炼系列(二):武功心法(info sed翻译+注解)sed修炼系列(三):sed高级应用之实现窗口滑动技术sed修炼系列(四):sed中 ...

  6. Variables and Arithmetic Expression

    Notes from The C Programming Language A decimal point in a constant indicates that it is floating po ...

  7. Codeforces CF#628 Education 8 E. Zbazi in Zeydabad

    E. Zbazi in Zeydabad time limit per test 5 seconds memory limit per test 512 megabytes input standar ...

  8. Oil Deposits

    Oil Deposits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

  9. TOJ1334

                                                                   1334: Oil Deposits 时间限制(普通/Java):1000 ...

随机推荐

  1. JFrome 登陆/注册/回显/输出流小程序之二

  2. Android获取屏幕的高度和宽度

    方法一: DisplayMetrics metrics=new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics( ...

  3. 小议window.event || ev

    以前做项目时就遇到这个问题,但是太懒没有总结,今天来总结一下 onclick="alert(arguments.callee)"这句随便放在某个元素中,试试不同的浏览器会有弹出什么 ...

  4. php中文件引入require

    ./ 表示当前层 ../表示向上一层 php中好像不能像asp那样,用 “/” 表示根目录,但可以用$_SERVER['DOCUMENT_ROOT'] 表示网站根目录 引用分为三种: 上级对下级的引用 ...

  5. python——BS解析器

  6. Linux Makefile多目录的编写

    手头一个项目,需要编写项目的makefile 多目录结构: csource/ ├── common│   └── sqlite3├── inc│   ├── curl│   ├── lua│   └─ ...

  7. poj 2886Who Gets the Most Candies?

    http://poj.org/problem?id=2886 #include <cstdio> #include <cstring> #include <algorit ...

  8. Scala开启之旅

    嘿嘿,公司最近需要测试SPARK性能,赶上了.. 那LUA之后,SCALA也简单看看,,, 其实,我三月时买了本129元的SPARK的书,,全国只那一本哈. package com.hengheng. ...

  9. new Random().nextInt

    public static void main(String[] args) { System.out.println(new Random().nextInt(0)); } Exception in ...

  10. 使用C#开发ActiveX控件 11

    C#开发ActiveX控件   ActiveX 是一个开放的集成平台,为开发人员.用户和 Web生产商提供了一个快速而简便的在 Internet 和 Intranet 创建程序集成和内容的方法. 使用 ...