0

ファイル内で、2 つの別個の用語を含まない行を削除しようとしています。動作するようになりましたが、どのように動作したかはわかりません。

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

誰か説明できますか?

4

1 に答える 1

1

HETATMあなたのsed行は、またはで始まらないすべての行を削除します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'
于 2013-09-09T19:11:55.677 に答える