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*

9
  • Awesome ! I'd like to upvote you but I don't have enough reputation yet for that. Of course I did know it was not easy at all but it was hard for me to believe it was impossible. Your code seems really huge and powerful and I'm not able to understand it. xD Thank you really much for your time. However, I tested it with some different inputs and I found one that made it crash. In this case: /*.foo */ foo hello The foo outside the comment block isn't substituted and the last line is even repeated twice. I don't know if it's fixable. Anyway, thanks again, that's such a great job ! Commented Apr 10, 2015 at 12:19
  • In the previous comment, each block is a new line. I don't know if the problem is due to the fact I'm using gsed on mac osx btw. Commented Apr 10, 2015 at 12:20
  • @Vrakfall - each block? what's a block? if I do just /*.foo */ foo it works... But I think I need $!N anyway... It also works with several blank lines above it....? I wrote this for GNU sed because that's what you mentioned in the question. Commented Apr 10, 2015 at 13:51
  • Yeah, I'm still using gnu sed. By block, I meant this because I cannot enter newlines in comments. So /*.foo*/ foo does work. Let's say you replace \n with a new line in the following, it won't work and will double the last line: /*.\nfoo*/\nfoo\nhello. Commented Apr 10, 2015 at 14:05
  • @Vrakfall - thanks for that. It helped me see an easier way to do it actually - if not much easier. It's fixed now. Commented Apr 10, 2015 at 14:41