====== SED - Delete - Delete all CONSECUTIVE blank lines from file except the first ====== Also deletes all blank lines from top and end of file (emulates "cat -s"). sed '/./,/^$/!d' # method 1, allows 0 blanks at top, 1 at EOF sed '/^$/N;/\n$/D' # method 2, allows 1 blank at top, 0 at EOF