Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图在文件中删除不包含两个单独术语的行。我让它工作,但不确定它是如何工作的。
sed -i '/^HETATM/!{/^ATOM/!d}' file
有人可以解释吗?
您的 sed 行将删除所有不以HETATMor开头的行ATOM
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'