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.循环读取文件里的字符,用一 ...
随机推荐
- 百度小程序button去掉默认边框
百度小程序button去掉默认边框: button::after{ border:none; }
- JQuery 知识
1.修改标签内容: *html( ) 相当于innerHTML * text( ) 相当于innerText 2.属性操作: *attr( ) 读/写/添加/设置属性 *removeAttr ...
- Python 生成器, 迭代器, 可迭代对象的区别
1.可迭代对象 在python中, 一切皆对象, 但凡是可以用for循环进行遍历取值的对象都可以称之为可迭代对象, 可迭代对象在程序的一个执行周期中,可以无限轮次的进行循环遍历 2.迭代器 a.一个可 ...
- 异常处理,约束,MD5加密日志处理
程序运行过程中产生的错误, 不正常 def chufa(a, b): try: # 尝试执行xxx代码 ret = a/b # 如果这里出现了错误. 异常. 系统内部会产生一个异常对象. 系统会把这个 ...
- select2插件使用小记2 - 多选联动 - 笔记
这是select2插件使用的第二篇,可参考第一篇 select2插件使用小记.上一篇主要是关于基本的使用,这篇主要是关于多选,及联动的.侧重点不同. 效果图如下: 遵从W3C标准:结构.样式.行为.以 ...
- swiper4-vue 不使用loop,由最后一张跳到第一张
<template> <div class="swiper-box"> <div class="swiper-container" ...
- 域名直接访问应用程序-不加端口号&不加路径名
当访问域名的时候,端口默认指定的是80: 而80端口在Linux系统下,1024之前的端口是只有root用户才能使用的, 因此将,系统层面将端口80 映射到8080, iptables -t nat ...
- 集合框架map_DAY18
1:map集合(掌握) (1)Map集合存储的是键值对元素.键是唯一的,值可以重复. (2)Map和Collection的区别? A:Map是双列集合,存储的元素键值对,键唯一,值可以重复. B:Co ...
- MVC3学习:利用mvc3+ajax结合MVCPager实现分页
本例使用表格Users(Uid,UserName,PassWord),数据库访问使用EF first code. public class Users { [Key] public int Uid { ...
- docker(三)docker镜像和镜像发布方法
一.从公网docker hub 拉取image ~ # 搜索docker search centos~ » docker pull centos admin@steven- Using default ...