You can use cat -s or –squeeze-blank options to suppress repeated empty output lines.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
## Add data in your file echo -e "one\n\n\ntwo\n\n\nthree" > myfile ## Multiple empty lines are replaced by single empty line cat -s myfile ## Returns ## one ## ## two ## ## three ## Without any options cat myfile ## Returns ## one ## ## ## two ## ## ## three |