Originally Posted by bathory
I believe the O.P. wants to slurp all lines up one the first one, but this just removes blank lines. You can easily do it with perl. sed can probably do it too, but there's nothing wrong with a little variety eh?
perl -ne 'chomp; print "$_ ";' myfile
This might cause you to wind up with some extra whitespace if you have blank lines or spaces at the start or end of lines. This will solve that problem:
perl -ne 'chomp; s/(^\s+|\s+$)//g; print "$_ " if ( $_ ne "" );' doc