一品网
  • 首页

linux中输出匹配行及其后的若干行


1、

[root@rhel7pc1 test]# ls
a.txt
[root@rhel7pc1 test]# cat a.txt
1 k d f
2 x c g
3 z c b
4 e w e
5 z c x
6 e d g
7 i j e
[root@rhel7pc1 test]# grep -A 1 -w "x" a.txt
2 x c g
3 z c b
--
5 z c x
6 e d g
[root@rhel7pc1 test]# sed -n '/x/, +1p' a.txt
2 x c g
3 z c b
5 z c x
6 e d g
linuxshell

相关


linux shell 删除满足正则表达式的文件

Linux Shell获取CCTV5节目单

linux shell利用nc命令,检测别的机器端口

Linux shell脚本 删除日志文件保留最新的 3 条文件

Linux Shell脚本自动化编程实战-开篇介绍

linux shell实现将每隔一个空格的两列并排为一列

Linux Shell脚本自动化编程实战-shell变量(二)

说说Linux shell外部命令与内建命令

Linux Shell简介

Linux shell ${}简单用法

Linux shell 判断变量是否包含某个字符串的几种方法

[Dockerfile Linux Shell] if else语句中比较字符串

标签

一品网 冀ICP备14022925号-6