我的sed代码有效.但我不知道为什么.有人可以帮助我理解



我正在尝试删除不包含两个单独术语的文件中的行。我让它工作,但不确定它是如何工作的。

sed -i '/^HETATM/!{/^ATOM/!d}' file

有人可以解释一下吗?

您的sed行将删除所有不以HETATMATOM开头的行

'/^HETATM/!   #if the line is not starting with HETATM, continue to process
{/^ATOM/!d}'  #then we come here, if the line is not starting with ATOM, Del the line

我会这样写:

sed  '/^A|^B/!d'

相关内容

最新更新