In article <[EMAIL PROTECTED]>, Daniel Tiefnig <[EMAIL PROTECTED]> writes: > If you're free to output whatever you want on mismatch, you can also > just omit the "\G". > > -p0 s/(.*)(.* > )(?=\1.\2|$)//g > > Will print all lines that preceed invalid changes. (As requested!) One > can create files that will make some problems, though. If a line does > not add at least one character, strange things may happen. But I think > it will always output something. > And until someone proves the contrary, I consider this being the > shortest solution so far. :o) >
Correct. It outputs at least the first char of a non-extendable line or the newline after it if that line is empty. By the way, what these programs don't check is if the first line is a single character. The challenge statement is unclear on if the first line should be seen as an extension of a ghost empty line or not.