How do I replace the first blank line with two lines of content? I did see a question on replacing multiple blank lines with a single blank line in vim sed but don't quite see how to adapt that. So, for example, if my input file is:
% abd
% def
% jkl
% mno
I would like to have a sed command that replaces just the first blank line with these two lines (one containing ghi
and the other containing %
):
% abd
% def
% ghi
%
% jkl
% mno
jkl
? – Michael Mrozek May 24 '11 at 05:41jkl
supposed to become? Could you express the requirements in English as well, for example “replace all blank lines by a fixed multi-line text” or “replace all blank lines by a blank line preceded by a copy of the next line”? – Gilles 'SO- stop being evil' May 24 '11 at 19:30%ghi\n%
where the\n
represents a linefeed to get me to the next line so that there is a line with just a%
on it. Hope that removes the confusion. – Peter Grill May 24 '11 at 22:29