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.
ファイル内で、2 つの別個の用語を含まない行を削除しようとしています。動作するようになりましたが、どのように動作したかはわかりません。
sed -i '/^HETATM/!{/^ATOM/!d}' file
誰か説明できますか?
HETATMあなたのsed行は、またはで始まらないすべての行を削除します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'