我会解释我的问题,但粘贴代码更容易
测试.sh
sed -i '/192.168.1.1/d' *
我希望它在此搜索中排除自己,我该怎么做呢?
最佳答案
最简单的解决方案是使用 bash
的扩展模式语法。
shopt -s extglob
sed -i '/192.168.1.1/d' !(test.sh)
模式 !(test.sh)
匹配所有除了 test.sh
。
关于regex - SED 脚本 - 排除 self ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43793755/