linux shell: 搜索字符串,剔除包含特定字符的行

搜索代码中出现CONFIG_BOOTARGS的行,但又不希望有#define和#undef,

暂时不知带如何直接用一个语句做到,因此用了如下三个语句.

find . -type f | xargs grep CONFIG_BOOTARGS > result.log;  sed -i '/#define/d' result.log;  sed -i '/#undef/d' result.log;

//找到含CONFIG_BOOTARGS的行

//剔除包含特定字符#define的行

//再剔除包含特定字符#undef的行

原文地址:https://www.cnblogs.com/mylinux/p/5663680.html