Perhaps your original file has MS-DOS line endings (\r\n
), and whatever you use to display the file is smart enough to detect that. Then, when you add a line with unix line ending (\n
) to the top, the detection breaks, and you get shown the blank lines inbetween.
Edit There are myriads of ways to convert line endings. Most editors can do it for you interactively. In your case, you can for instance extend your pipeline with
| tr -d '\r' > output.txt