Counting Lines, Words, and Characters with wc
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的更多相关文章
- Linux shell basic3 dd wc comm chmod ls
Generating files of any size /dev/zerois a character special device, which infinitely returns the ze ...
- 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 ...
- sed正则表达式
sed的正则匹配如何实现非贪婪? sed的正则用的是BREs/EREs,不支持非贪婪模式.当然有一些方法可以实现非贪婪,比如: $ echo abcOabcdOabc | sed 's/.*O//' ...
- sed武功心法(info sed翻译+注解)
本文中的提到GNU扩展时,表示该功能是GNU为sed提供的(即GNU版本的sed才有该功能),一般此时都会说明:如果要写具有可移植性的脚本,应尽量避免在脚本中使用该选项. 本文中的正则表达式几乎和gr ...
- sed修炼系列(二):sed武功心法(info sed翻译+注解)
sed系列文章: sed修炼系列(一):花拳绣腿之入门篇sed修炼系列(二):武功心法(info sed翻译+注解)sed修炼系列(三):sed高级应用之实现窗口滑动技术sed修炼系列(四):sed中 ...
- Variables and Arithmetic Expression
Notes from The C Programming Language A decimal point in a constant indicates that it is floating po ...
- 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 ...
- Oil Deposits
Oil Deposits Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
- TOJ1334
1334: Oil Deposits 时间限制(普通/Java):1000 ...
随机推荐
- locate 不能使用
当需要查找一个文件,只知道文件名不知道路径,我们通常用locate,由于公司的服务器使用最小化安装的所以当locate 文件名,报错,提 示-bash: locate: command not fou ...
- android异常之emulator-arm.exe已停止工作
我遇到的这个问题通过降低了AVD的分辨率后解决了,估计是电脑的显卡不行.
- HTML5验证及日期显示
以前忽略了HTML5的强大功能,谁知有了它数据大部分都不需要自己验证,显示日历也不需要插件啦,一些小功能分享给大家 1.Email输入框,自动验证Email有效性. <!DOCTYPE HTML ...
- 001.为什么选择用AngularJs开发?
网上关于AngularJs(https://angularjs.org/)的介绍与好处已经相当多了,大家可以自己去搜索看看,很多很多. 1.疯狂的原生的App开发 在这里我主要谈一下我自己为什么要使用 ...
- Llinux-apache安装
第四章 构建LAMP网站服务平台 实验报告 1.安装apache服务器软件及相关组件 查看系统中是否安装apache服务相关的软件包: [root@www /]# rpm -qa | grep ht ...
- C++ STL基本容器的使用
C++中有两种类型的容器:顺序容器和关联容器.顺序容器主要有vector.list.deque等.其中vector表示一段连续的内存,基于数组实现,list表示非连续的内存,基于链表实现,deque与 ...
- FCKEditor使用说明
1.基本设置 先看看效果是什么样的: 效果图: 那么为什么说是FCKeditor的冰冷之心呢?这不是哗众取宠,主要是说它使用起来有点麻烦,下文就详细说明如何搞定这玩意儿. 1.FCKedito ...
- java Html2Image 实现html转图片功能
//java Html2Image 实现html转图片功能 // html2image HtmlImageGenerator imageGenerator = new HtmlImageGenera ...
- JS和正则表达式验证手机号码、邮箱等
<-------------------------------------验证手机号码---------------------------------------------> fun ...
- Xamarin.Forms本地化多语言
Forms 右键新建文件夹 Localization 新建文件TranslateExtension.cs namespace Localization { /// <summary> // ...