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
    +1 for the awk solution. Bonus for style. Very tight, clean and readable solution. Goes straight to my cheat sheet :) Commented Jan 3, 2013 at 9:01
  • 1
    the awk-solution is... wow Commented Jan 3, 2013 at 14:39
  • I had to add a print; before skip=1 for it to work properly in my machine (it was not printing the begin block). should this be edited in the answer? Commented Jun 12, 2015 at 23:35
  • 1
    @elias Indeed that was a bug, thanks. I also implemented another requirement that I'd missed: add the dynamic block at the end if it wasn't present. Commented Jun 13, 2015 at 0:07
  • @Gilles oh, I had missed that too. :) Commented Jun 13, 2015 at 0:17