I have a file that contains:
something
something else
something else again
I need a bash command, sed/grep w.e that will produce the fo
For BSD-derived systems (including GNU):
You just need cat
with the -s
option which causes it to remove repeated empty lines from its output:
cat -s
From man page: -s --squeeze-blank: suppress repeated empty output lines.
Super easy to do with vim. Just open the file and type the following:
:%s/\n\n\n*/\r\r/
That will reduce all blocks of more than 2 new lines to 2 new lines. Hope this helps!