There are some techniques and it depends on your goals. For example, you can use h for the first line and remove the new line after each H or at the end of the input ...
Removing for each append:
seq -w 10 | sed -n 'H;x;s/\n//g;x;${x;p}'
Removing at the end:
seq -w 10 | sed -n '1h;1!{H};${x;s/\n//g;p}'
The trick is using x (exchange the contents of the hold and pattern spaces) and remove the newline.
There are some techniques and it depends on your goals. For example, you can use
hfor the first line and remove the new line after eachHor at the end of the input ...Removing for each append:
Removing at the end:
The trick is using
x(exchange the contents of the hold and pattern spaces) and remove the newline.