cat、head、sed 三盟友
在linux 中我们必不可少的会使用到这三个命令
他们有什么作用呢?
就是查看文档了,但他的功能远不止于此
来我们学习一下吧
cat

[root@ESProbe ~]# cat --help
Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s), or standard input, to standard output.
-A, --show-all equivalent to -vET
-b, --number-nonblank number nonempty output lines, overrides -n
-e equivalent to -vE
-E, --show-ends display $ at end of each line
-n, --number number all output lines
-s, --squeeze-blank suppress repeated empty output lines
-t equivalent to -vT
-T, --show-tabs display TAB characters as ^I
-u (ignored)
-v, --show-nonprinting use ^ and M- notation, except for LFD and TAB
--help display this help and exit
--version output version information and exit
With no FILE, or when FILE is -, read standard input.
Examples:
cat f - g Output f's contents, then standard input, then g's contents.
cat Copy standard input to standard output.
GNU coreutils online help: http://www.gnu.org/software/coreutils/
For complete documentation, run: info coreutils 'cat invocation'
-b 显示行号
[root@ESProbe ~]# cat -b /etc/passwd
1 root❌0:0:root:/root:/bin/bash
2 bin❌1:1:bin:/bin:/sbin/nologin
3 daemon❌2:2:daemon:/sbin:/sbin/nologin
4 adm❌3:4:adm:/var/adm:/sbin/nologin
5 lp❌4:7:lp:/var/spool/lpd:/sbin/nologin
6 sync❌5:0:sync:/sbin:/bin/sync
7 shutdown❌6:0:shutdown:/sbin:/sbin/shutdown
8 halt❌7:0:halt:/sbin:/sbin/halt
9 mail❌8:12:mail:/var/spool/mail:/sbin/nologin
10 operator❌11:0:operator:/root:/sbin/nologin
11 games❌12
cat、head、sed 三盟友的更多相关文章
- 删除所有空白列 cat yum.log | awk '{$1=$2=$3=$4=null;print $0}'>>yum.log1 sed ‘s/[ \t]*$//g' 删除所有空格 sed -i s/[[:space:]]//g yum.log
2.删除行末空格 代码如下: 删除所有空白列 cat yum.log | awk '{$1=$2=$3=$4=null;print $0}'>>yum.log1 sed 's/[ \t]* ...
- find cat sed awk 简单组合使用
find:查找 // .表示当前目录: /表示根目录: | 管道符: xargs表示将前面的搜索接口作为参数传递到后面的命令中:grep 过滤 // xxxx表示文件名 1.查找指定文件名的文 ...
- Linux下的shell编程(三)BY 四喜三顺
正则表达式:-------------------------------------------------------------------------------------------^ ...
- Linux三剑客之sed
sed sed对文本的处理很强大,并且sed非常小,参数少,容易掌握,他的操作方式根awk有点像.sed按顺序逐行读取文件.然后,它执行为该行指定的所有操作,并在完成请求的修改之后的内容显示出来,也可 ...
- Shell之sed用法 转滴
通过例子学习sed的用法 1,sed介绍 sed可删除(delete).改变(change).添加(append).插入(insert).合.交换文件中的资料行,或读入其它档的资料到 文> ...
- sed的实际用法举例
sed:Stream Editor文本流编辑,sed是一个“非交互式的”面向字符流的编辑器.能同时处理多个文件多行的内容,可以不对原文件改动,把整个文件输入到屏幕,可以把只匹配到模式的内容输入到屏幕上 ...
- sed文本处理知识点整理
参考资料:http://man.linuxde.net/sed <鸟哥的私房菜> sed是一种流编辑器,它是文本处理中非常中的工具,能够完美的配合正则表达式使用.sed 后面接的操作 ...
- sed and awk学习笔记
sed and awk 背景 awk起源追溯至sed和grep,进而追溯至共同的行编辑器ed.实用工具grep来源于ed命令:g/re/p .实用工具awk和sed有一个共同的选项-f用于指定脚本的名 ...
- SED&AWK
SED 1.sed是流编辑器(stream editor)缩写,作用主要是文本替换 命令格式:sed ‘s/pattern/replace_string/' file或者cat file | se ...
随机推荐
- [LC] 104. Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...
- LINQ之路 7:子查询、创建策略和数据转换(要点笔记)
匿名类型 上面我们自己定义了类型TempProjectionItem来存放查询的结果.通过使用匿名类型,我们可以省去这种中间类型的定义,而由编译器来帮我们完成: select item.Origina ...
- 三年无限流量免费随身WiFi充电宝是真的还是套路?
一般来说大家现在看到"无限流量"."免费"等字眼,总会有一种"这是陷阱"."这是大坑"."就要黑你钱" ...
- HexoC++第04课 构造析构.md
C++第04课 构造析构.mdhtml {overflow-x: initial !important;}#write, body { height: auto; } #write, #write h ...
- wabpack踩坑
webpack 打包时会用 NODE_ENV 来标识是生产环境还是开发环境光, "build": "NODE_ENV=production webpack", ...
- C#利用反射调用PB编译的COM组件
问题: 1.根据COM组件的ProgID,得到COM组件公开的类型 2.创建COM组件提供的类型的对象 3.调用执行方法 正确姿势 C#利用反射调用(后期绑定)PB编译的COM组件 C#调用COM组件 ...
- js大作业(0)
DAY1:在看HTML5游戏开发实战.手写了一遍乒乓球.自己玩了半小时.实话讲,和本科学的MFC差别不大.通过setInterval函数获取用户的输入 从而允许多用户操作.parseInt把字符串化为 ...
- ResultMap和ResultType到底有什么区别?
转载请标明出处:https://www.cnblogs.com/Dreamice/ 首先,SQL语句执行后返回的结果可以使用 Map 存储,也可以使用 POJO 存储. 一.使用Map存储结果集 下面 ...
- SQL语句中in not in exits not exits用法比较
exists (sql 如果返回结果集为真) not exists (sql 如果没有返回结果集为真) 如下: 表A ID NAME 1 A1 2 A2 3 A3 表B ID AID NAME 1 1 ...
- Geohash介绍
Geohash介绍 Geohash是一种地址编码,能把二维的经纬度编码成字符串,某一区域范围内的经纬度是一致的,其中有编码长度控制区域的范围 精度参考 使用场景 实时LBS应用 LBS应用中,搜索某某 ...