For those who want to write portable sed scripts,
be aware that some implementations have been known to
limit line lengths (for the pattern and hold spaces)
to be no more than 4000 bytes.
The posix standard specifies that conforming sed
implementations shall support at least 8192 byte line lengths.
GNU sed has no built-in limit on line length;
as long as it can
malloc() more (virtual) memory,
you can feed or construct lines as long as you like.
However, recursion is used to handle subpatterns and indefinite repetition. This means that the available stack space may limit the size of the buffer that can be processed by certain patterns.