Linux常用基本命令wc-统计文件的字节,字符,行数
wc命令
作用:统计文件的字节,单词,行数
用法:wc [option] [file]
-c:统计字节
ghostwu@dev:~/linux/uniq$ cat ghostwu.txt
192.168.1.2
192.168.1.8
192.168.1.3
192.168.1.3
192.168.1.9
192.168.1.8
192.168.1.8
192.168.1.0
192.168.1.3
ghostwu@dev:~/linux/uniq$ wc -c ghostwu.txt
ghostwu.txt
ghostwu@dev:~/linux/uniq$ ls -lh
total .0K
-rw-rw-r-- ghostwu ghostwu 5月 : ghostwu.txt
-l : 统计行数:
ghostwu@dev:~/linux/uniq$ cat -n ghostwu.txt
192.168.1.2
192.168.1.8
192.168.1.3
192.168.1.3 192.168.1.9
192.168.1.8
192.168.1.8
192.168.1.0
192.168.1.3
ghostwu@dev:~/linux/uniq$ wc -l ghostwu.txt
ghostwu.txt
-m: 统计字符
ghostwu@dev:~/linux/uniq$ cat char.txt
hello,my name is ghostwu
ghostwu@dev:~/linux/uniq$ wc -m char.txt
char.txt
-c: 统计字节
ghostwu@dev:~/linux/uniq$ wc -c char.txt
char.txt
-c与-m的区别,"你好啊" 是3个字符,占用9个字节。一般情况下,一个中文在utf8编码下,占用3个字节
ghostwu@dev:~/linux/uniq$ wc -m char.txt
char.txt
ghostwu@dev:~/linux/uniq$ wc -c char.txt
char.txt
ghostwu@dev:~/linux/uniq$ cat char.txt
hello,my name is ghostwu
你好啊
-w: 统计单词,空格隔开才算一个单词
ghostwu@dev:~/linux/uniq$ cat char.txt
hello,my name is ghostwu
你好啊
ghostwu@dev:~/linux/uniq$ vim char.txt
ghostwu@dev:~/linux/uniq$ wc -w char.txt
char.txt
ghostwu@dev:~/linux/uniq$ vim char.txt
ghostwu@dev:~/linux/uniq$ cat char.txt
hello my name is ghostwu
你 好 啊
ghostwu@dev:~/linux/uniq$ wc -w char.txt
char.txt
-L:打印最长行的长度
ghostwu@dev:~/linux/uniq$ wc -L char.txt
char.txt
Linux常用基本命令wc-统计文件的字节,字符,行数的更多相关文章
- linux常用命令 wc统计命令
统计命令wc wc [选项] 文件名 选项 -l 只统计行数 -w 只统计单词数 -m 只统计字符数 192:linux_worspace aouo$ wc /etc/passwd 103 ...
- Linux统计文件个数或是代码行数
统计指定后缀名的文件总个数命令: find . -name *.cpp | wc -l 统计一个目录下代码总行数以及单个文件行数: find . -name *.h | xargs wc -l lin ...
- 利用fgetc统计文件所在字节 和 总行数 和单词数
#include <stdio.h> #include <stdlib.h> #define IS_WHITE_SPACE(c) ((c)==' '||(c)=='\t'||( ...
- Linux - wc统计文件行数、单词数或字节数
一 wc简单介绍 wc命令用来打印文件的文本行数.单词数.字节数等(print the number of newlines, words, and bytes in files).在Windows的 ...
- Linux常用基本命令(less)
转: Linux常用基本命令(less) LESS:跟more命令的功能类似,都是用于分页显示内容,但是他的性能比more更高,功能比more更丰富,他读取文件是按需加载 格式: less [opti ...
- Linux 常用基本命令及应用技巧
需要pdf 版 联系我 我的文件中有目录一.Linux 的常用基本命令................................................................. ...
- wc 统计文件的行数
1.命令功能 wc 统计文件的行数,单词和字节数 2.语法格式 wc option file wc option --files0-from=F 参数说明 参数 参数说明 -c 统计字节数 - ...
- 【原】Mac下统计任意文件夹中代码行数的工
[链接][原]Mac下统计任意文件夹中代码行数的工http://www.cnblogs.com/wengzilin/p/4580646.html
- Java笔记13:统计文件中每个字符出现的次数
一.代码实现 import java.io.*; import java.util.*; /** 功能:统计文件中每个字符出现的次数 思路: 1.定义字符读取(缓冲)流 2.循环读取文件里的字符,用一 ...
随机推荐
- Python random模块 获取随机数的使用
random.randomrandom.random()用于生成一个0到1的随机符点数: 0 <= n < 1.0 random.uniformrandom.uniform(a, b),用 ...
- [宁波集训]0827Day1
1.\(CF771D\ Bear\ and\ Company\)(原题,比赛时改为多组数据) 一道毒瘤\(dp\)题,\(dp[i][j][k][0/1]\)表示有\(i\)个\(V\),有\(j\) ...
- 31_网络编程-struct
一.struct 1.简述 我们可以借助一个模块,这个模块可以把要发送的数据长度转换成固定长度的字节.这样客户端每次接收消息之前只要先接受这个固定长度字节的内容看一看接下来要接收的信息大小,那么 ...
- web开发常用网络优化
优化方法: 1.合并资源文件,减少HTTP请求 2.压缩资源文件减少请求大小 3.利用缓存机制,尽可能使用缓存减少请求 如何做前端路由 html5 api中的history能够让我们控制url跳转之后 ...
- spring boot实现异步调用
今天在这里学习下使用springboot的异步调用async 首先使用@EnableAsync开启异步功能 /** * @author fengzp * @date 17/5/8 * @email f ...
- 解决 canvas 绘图在高清屏中的模糊问题
解决 canvas 绘图在高清屏中的模糊问题 为什么模糊 CSS 像素是一个抽象单位(1 px),浏览器根据某种规则将 css 像素转化为屏幕需要的实际像素值. 在高清屏之前,屏幕上显示一个像素点需要 ...
- spring mvc 使用kaptcha配置生成验证码实例
SpringMVC整合kaptcha(验证码功能) 一.依赖 <dependency> <groupId>com.github.penggle</groupId> ...
- Data - Hadoop单机配置 - 使用Hadoop2.8.0和Ubuntu16.04
系统版本 anliven@Ubuntu1604:~$ uname -a Linux Ubuntu1604 4.8.0-36-generic #36~16.04.1-Ubuntu SMP Sun Feb ...
- POJ 2661
#include<iostream> #include<stdio.h> using namespace std; int main() { //freopen("a ...
- Mxonline3.6 在阿里云服务器上的部署(uwsgi nginx)
我的项目结构 1. 执行`python manage.py migrate`命令,将迁移文件,映射到数据库中,创建相应的表. 进入数据库 use mxonline数据库 source /hom ...