相当肯定我错过了一些明显的东西!使用不同的分隔符删除
$ cat test.txt
00 30 * * * /opt/timebomb.sh >> timebomb.log
01 30 * * * /opt/reincarnate.sh >> reincarnation.log
$ sed ':timebomb:d' test.txt
00 30 * * * /opt/timebomb.sh >> timebomb.log
01 30 * * * /opt/reincarnate.sh >> reincarnation.log
而
$ sed '/timebomb/d' test.txt
01 30 * * * /opt/reincarnate.sh >> reincarnation.log
为什么是这样呢? d
命令是否支持不同的分隔符集?
的可能的复制[使用斜线在sed替换(http://stackoverflow.com/questions/5864146 /使用-斜线合sed的替换) – tripleee 2015-12-17 12:28:00