I tried to remove all newlines in a pipe like this:
(echo foo; echo bar) | sed -e :a -e N -e '$!ba' -e 's/\n/ /g' | hexdump -C
Which results on debian squeeze in:
00000000 66 6f 6f 20 62 61 72 0a |foo bar.|
00000008
Not removing the trailing newline.
tr -d '\n'
as in How do I remove newlines from a text file? works just fine but isn't sed.