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.

Required fields*

3
  • 1
    It would help us if you could provide a piece of sample data and what you expect the command to do to the sample data. Commented Oct 2, 2020 at 12:10
  • 3
    You can't match the newlines of the input data in sed like that (there are no newlines in the data that you see in sed). If you show some example data, we would be able to say whether it would be enough to anchor the expression to the end with $, or if you have to do something else. Also, depending on the sed implementation that you use, newlines may possibly not be inserted in the replacement part of the s/// command. Commented Oct 2, 2020 at 12:12
  • 1
    @Kusalananda Edited! Also, it looks like anchoring with $ was just what I needed, thank you! Commented Oct 2, 2020 at 12:19