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.

4
  • Yes, those are both proper ways to do it with sed. Future visitors should keep in mind that i requires any embedded backslashes to be escaped. Commented Aug 5, 2018 at 18:32
  • And that the empty label and ; concatenation are GNU extensions to sed. Commented Aug 6, 2018 at 9:37
  • @TobySpeight - empty label is specified by POSIX: "b [label] Branch to the : command verb bearing the label argument. If label is not specified, branch to the end of the script". Some commands can also be concatenated via ; per the same standard: "Editing commands other than {...}, a, b, c, i, r, t, w, :, and # can be followed by a <semicolon>, optional <blank> characters, and another editing command." Commented Aug 6, 2018 at 12:32
  • Thanks for the correction (I note that : is among the commands that can't be joined with a subsequent command, so I turned out to be slightly correct by accident!) Commented Aug 6, 2018 at 12:42