Raw Input Desired Output
Line 1.
Line 2.
Line 3.
Line 4.
Line 5.
Line 6.
Line 7.
Line 1.Line 2.
Line 2.Line 3.
Line 3.Line 4.
Line 4.Line 5.
Line 5.Line 6.
Line 6.Line 7.
Line 7.
Script and Comments
Script1
[ 1] N
[ 2] s/^\(.*\)\n\(.*\)/\1\2\n\2/
[ 3] P
[ 4] D
Comments
  1. The following table is used to demonstrate how this script works:
    After
    which step
    CommandPattern SpaceNote
    Before any
    command
     Line 1.  
    [1]N Line 1.\nLine 2.  
    [2]s///Line 1.Line 2.\nLine 2. 
    [3]P Line 1.Line 2.\nLine 2.'P' prints 'Line 1.Line 2'.
    [4]D Line 2. sed jumps to Step [1].
  2. If the current line is the last one of a file, then there is no more line can be joined via command 'N', GNU sed will print the contents of Pattern Space and exit. For portability, you can replace Step [1] with '$!N'.