This one-liner avoids that
That may very well be what the OP actually wants, but it is not equivalent his stated goal.
The OP's goal was to "translate double newlines to single newlines." Your code gets rid of blank lines. Consider what happens when a file starts with a blank line. Or, for another example, when there is a non-blank line followed by two blank lines. Etc.
In reply to Re^2: how to use matching operator on newlines
by sauoq
in thread how to use matching operator on newlines
by redss
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |