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.

  1. [root@rhel7 ~]# wc --help
  2. Usage: wc [OPTION]... [FILE]...
  3. or: wc [OPTION]... --files0-from=F
  4. Print newline, word, and byte counts for each FILE, and a total line if
  5. more than one FILE is specified. With no FILE, or when FILE is -,
  6. read standard input. A word is a non-zero-length sequence of characters
  7. delimited by white space.
  8. The options below may be used to select which counts are printed, always in
  9. the following order: newline, word, character, byte, maximum line length.
  10. -c, --bytes print the byte counts
  11. -m, --chars print the character counts
  12. -l, --lines print the newline counts
  13. --files0-from=F read input from the files specified by
  14. NUL-terminated names in file F;
  15. If F is - then read names from standard input
  16. -L, --max-line-length print the length of the longest line
  17. -w, --words print the word counts
  18. --help display this help and exit
  19. --version output version information and exit
  20.  
  21. GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
  22. For complete documentation, run: info coreutils 'wc invocation'
  23. [root@rhel7 ~]# cat wctest |wc -w
  24.  
  25. [root@rhel7 ~]# cat wctest | wc -l
  26.  
  27. [root@rhel7 ~]# cat wctest |wc -c
  28.  
  29. [root@rhel7 ~]# cat wctest |wc -m
  30.  
  31. [root@rhel7 ~]# cat wctest |wc -L
  32.  
  33. [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. 30.SSH配置文件模板.md

    [toc] 1.struts2 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts ...

  2. directshow filter 调试步骤

    1,编写filter 2,在debug模式下build 3,注册filter:控制台cd到工程的debug目录下,即欲注册的filter(.ax文件)目录,xx:>regsvr32 contra ...

  3. Objective-C内存管理与原理

    尽管苹果在 iOS 5/ Mac OS X 10.7 开始导入ARC,利用 Xcode4.2 可以使用该机能.ARC就是自动引用计数,是一项为Objective - C程序在编译时提供自动内存管理的功 ...

  4. bc命令详解与实例

    bc: bc 是一种高精度的可交互执行的计算机语言.它在一些浮点数的运算中应用广泛. 一般情况下我们直接输入 bc ,便可进入其工作环境.当然,它还有其他的参数 -h 显示帮助信息并退出 -i 强制进 ...

  5. $().change事件

    change([[data],fn]) 当元素的value值发生改变时发生change事件 适用于: 文本域 text textarea和select元素 text textarea 元素失去焦点时发 ...

  6. CentOS 5.6服务器配置YUM安装Apache+php+Mysql+phpmyadmin

    1. 更新系统内核到最新. [root@linuxfei ~]#yum -y update 系统更新后,如果yum安装时提示错误信息,请执行以下命令修复. [root@linuxfei ~]#rpm ...

  7. Day3 set集合、函数和装饰器

    set特性:无序,不重复,可嵌套 创建setset_example = set("123", "213", "234", "432 ...

  8. Keil使用中的若干问题

    一.混合编程 1.模块内接口: 使用如下标志符: #pragma asm 汇编语句 #pragma endasm 注意:如果在c51程序中使用了汇编语言,注意在keil编译器中需要激活Properti ...

  9. Asteroids(二分图最大匹配模板题)

    Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12323   Accepted: 6716 Description Bess ...

  10. ZOJ(ZJU) 1002 Fire Net(深搜)

    Suppose that we have a square city with straight streets. A map of a city is a square board with n r ...