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
?jkl
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”?%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.