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は、matchとの一致後にいくつかの行を削除できます
sed -e /regexp/,+<number_of_lines>
しかし、たとえばこのまだ10行目に加えてどのように削除するか
アップデート
正確な質問ではありません。
一致後に2行目、3行目、4行目、6行目を削除し、それ自体を一致させる必要があります
持っている場合は、一致後(およびそれを含む)の10行を削除するGNU sedことができます。試合後の4行と10行目を削除することができます。sed '/regexp/,+10d' filesed '/regexp/,+4d;10d' file
GNU sed
sed '/regexp/,+10d' file
sed '/regexp/,+4d;10d' file