#All alternatives, unlike sed will not need to reach the last line to begin the process
#with bash, slow
while read line; do printf "%s" "$line "; done < file
#with perl, sed-like speed
perl -p -e 's/
/ /' file
#with tr, faster than sed, can replace by one character only
tr '
' ' ' < file
#with paste, tr-like speed, can replace by one character only
paste -s -d ' ' file
#with awk, tr-like speed
awk 1 ORS=' ' file
#Other alternative like "echo $(< file)" is slow, works only on small files and needs to process the whole file to begin the process.