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 ...
随机推荐
- Python之configparser配置文件的读取
配置文件名 config.ini 文件内容: [linux] ip:10.0.13.26 port:22 username:root password:W2ynE6b58wheeFho [mysql] ...
- json/xml processing model与xml和json的简要区别
1.JavaScript Object Notation(JSON) JSON是一种轻量级数据交换格式,广泛用作通用格式,用于序列化和反序列化通过Internet相互通信的应用程序中的数据.这些应用程 ...
- js怎么获取动态链式属性呢?
动态链式属性?我自己起的名字,样子就是 var data={ list:{ name:'zxf' } }var prop="list.name";console.log(data[ ...
- scatter散点图
import matplotlib.pyplot as plt import numpy as np n = 1024 X = np.random.normal(0,1,n) Y = np.rando ...
- PHP RFI 的小tip
有关PHP include的帖子网上已经很多了,wooyun的知识库里面也有一篇总结的很好的文章,传送门:http://drops.wooyun.org/tips/3827,今晚在看书的时候看到RFI ...
- 线上SpringCloud网关调用微服务跨机房了,咋整?
1.前言 公司内考虑到服务器资源成本的问题,目前业务上还在进行服务的容器化改造和迁移,计划将容器化后的服务,以及一些中间件(MQ.DB.ES.Redis等)尽量都迁移到其他机房. 那你们为什么不用阿里 ...
- NVARCHAR(MAX) 的最大长度
本文使用的环境是SQL Server 2017, 主机是64位操作系统. 大家都知道,Micorosoft Docs对 max参数的定义是:max 指定最大的存储空间是2GB,该注释是不严谨的: nv ...
- AAAI 2020论文分享:通过识别和翻译交互打造更优的语音翻译模型
2月初,AAAI 2020在美国纽约拉开了帷幕.本届大会百度共有28篇论文被收录.本文将对其中的机器翻译领域入选论文<Synchronous Speech Recognition and Spe ...
- 聊一聊MyBatis 和 SQL 注入间的恩恩怨怨
整理了一些Java方面的架构.面试资料(微服务.集群.分布式.中间件等),有需要的小伙伴可以关注公众号[程序员内点事],无套路自行领取 更多优选 一口气说出 9种 分布式ID生成方式,面试官有点懵了 ...
- removeAttribute getAttribute setAttribute
1.removeAttribute() 方法删除指定的属性. 注:removeAttributeNode() 方法从元素中删除指定的属性节点.简单的来讲,removeAttribute() 移除元素内 ...