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.循环读取文件里的字符,用一 ...
随机推荐
- Django(视图 CBV、FBV)
day67 参考:http://www.cnblogs.com/liwenzhou/articles/8305104.html CBV和FBV 我们之前写过的都是基于函数的view,就叫FBV.还可以 ...
- Postgres 的 deferrable
仅 Postgres 支持 deferrable deferrable 即 推迟约束 一.定义字段时指定 定义:exam考试表里 subject_iddddd 字段关联了 subject 科目表的 i ...
- cmd命令关闭占用程序的端口
遇到的问题: 在重新启动tomcat服务时,启动失败,显示的信息大概为:Error running 'cus_manager_system': Unable to open debugger port ...
- 阿里云centos 开启ipv6
参考网址 https://blog.chenjia.me/articles/160301-134110.html?spm=5176.bbsr285557.0.0.g1Oemn 阿里云限制了ipv6的功 ...
- GITLAB安装笔记
CentOS 7 最小安装后操作 设置时区timedatectl set-timezone Asia/Shanghai 添加 Gitlab 清华源 vi /etc/yum.repos.d/gitlab ...
- Fiddler抓包连接失败502的解决方法
本篇用户记录,在用Fiddler遇到过的坑,首先, 先上图,遇到的问题,提示主机连接失败.只是打开Fiddler,不会报这个问题,只有当Fiddler和火狐浏览器一起启动的时候,才会报这个错. 尝试去 ...
- POJ 2853
#include<iostream> #include<stdio.h> #include<vector> #include<math.h> #incl ...
- POJ 2410
#include <iostream> #include <cmath> #include <string> using namespace std; int gi ...
- (转)python的ConfigParser模块
原文:https://blog.csdn.net/miner_k/article/details/77857292 如何使用Python3读写INI配置文件-------https://blog.cs ...
- Intellij IDEA 编译等级与源代码等级不一致问题
错误:Error:java: javacTask: source release 1.7 requires target release 1.7 原因:生成class字节码的java版本,低于了源代码 ...