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*

5
  • 2
    If you're going to use GNU sed specific syntax, you might as well use sed -z 's/is/us/3'. Commented Jan 29, 2015 at 11:54
  • @StéphaneChazelas -z must be some brand new feature, my GNU sed version 4.2.1 doesn't know anything about this option. Commented Jan 29, 2015 at 12:06
  • 1
    Added in 4.2.2 (2012). In your second solution, you don't need the conversion to \x0 step. Commented Jan 29, 2015 at 12:17
  • Sorry about the edit. I had not seen the original version of the question and someone had misunderstood it and edited the wrong line. I reverted to the previous version. Commented Jan 29, 2015 at 12:33
  • This worked best in situation where there were no \n and it was a bash array requiring replacing of element separator data entered by user. Commented Jul 11, 2020 at 15:04