Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 1
    With -i you can edit the file in place: sed -i '/text to remove/d' filename is the same as cat filename | sed '/text to remove/d' Commented Jan 28, 2023 at 12:49
  • 2
    1. Avoid useless cat! 2. sed could do more than 1 command! sed -e '/text to remove/d;/remove this too/d' filename | more 3. you could enclose many pattern in one sed command: sed '/text to remove\|remove this too/d' filename | more Commented Oct 30, 2024 at 17:42