1.排除命令(取反)
1 This is the header line
2 This is the first line
3 This is the second line
4 This is the last line
使用排除的方式打印出不包含header的所有行的内容
# 不使用!取反打印出的内容
[root@tf1 sed-gaoji]# sed -n '/header/p' data3.txt
This is the header line
# 使用!排除包含header行之后打印出内容
[root@tf1 sed-gaoji]# sed -n '/header/!p' data3.txt
This is the first line
This is the second line
This is the last line
本文介绍了如何使用Linux的sed命令排除包含特定字符串的行,通过`!`操作符实现不打印含有header的行,从而筛选出数据文件中除头行外的其他内容。
24万+

被折叠的 条评论
为什么被折叠?



