我正在尝试删除不包含两个单独术语的文件中的行。我让它工作,但不确定它是如何工作的。
sed -i '/^HETATM/!{/^ATOM/!d}' file
有人可以解释一下吗?
您的sed行将删除所有不以HETATM
或ATOM
开头的行
'/^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'