Description
The original output produced by a program is a stream contains several data records of the form X1=Y1, and two adjacent records are separated by one space. Since the stream is too long, we wrote another program to add newline characters to split it to lines.

Unfortunately, the program places most newline characters at the wrong positions, producing an unacceptable file. In the following raw input, we use   to stand for a space. Note that Line 1 does not contain a trailing space but Line 2 does, since the trailing space is used to separate B=115 and C=1.46 in the stream.

What we want is reformatting the unacceptable file so that each line contains exactly one record.

Raw Input Desired Output
A=125
1 B=115 
C=1.46 D
=.3032 E
=90.2412
 F=154.7
 
A=1252
 B=115 C
=1.46 D=
2.26
2 E=
90.4308 
F=108.16
A=1251
B=115
C=1.46
D=.3032
E=90.2412
F=154.7
A=1252
B=115
C=1.46
D=2.262
E=90.4308
F=108.16
Script and Comments
Script1
[ 1] :loop
[ 2] / /!{
[ 3] $!N
[ 4] $!b loop
[ 5] }
[ 6] s/\n//g
[ 7] s/ /\n/
[ 8] P
[ 9] D
Comments
  1. Steps [1] thru [5] constitute a loop which will repeat joining lines to the Patten Space until there is at lease one space or the last line of file is reached.
  2. Step [6] will remove all newline characters generated by command 'N' in Step [3].
  3. There may exist more than one spaces in PS, but this script will process one at a time:
    • Step [7] is used to replace a space with newline.
    • Step [8] will print one data record.
    • Command 'D' in Step [9] then remove that record from PS, make sed branch to Step [1].