To remove the line and print the output to standard out:
(要删除行并将输出打印到标准输出,请执行以下操作:)
sed '/pattern to match/d' ./infile
To directly modify the file – does not work with BSD sed:
(要直接修改文件–不适用于BSD sed:)
sed -i '/pattern to match/d' ./infile
Same, but for BSD sed (Mac OS X and FreeBSD) – does not work with GNU sed:
(相同,但是对于BSD sed(Mac OS X和FreeBSD)–不适用于GNU sed:)
sed -i '' '/pattern to match/d' ./infile
To directly modify the file (and create a backup) – works with BSD and GNU sed:
(要直接修改文件(并创建备份)–与BSD和GNU sed一起使用:)
sed -i.bak '/pattern to match/d' ./infile
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…