Tickets/dm 1662

I can't understand what you've written, whereas it works fine ;-)
Could we please do it in two passes? One for the replacement and one which would append a line?
sed seems to have such a feature: http://stackoverflow.com/questions/15559359/insert-line-after-first-match-using-sed/15559399#15559399 (first answer look fine).