I need to merge line of a file using sed based on a pattern. eg:

Input File:

```
X1 A B C D E F

\+ G H I J 1 

\+ LK T PP E OO 2

X2 DDF F Y 

\+ J W Q 

```

....

OutPut Expected:

```
X1 A B C D E F G H I J 1 LK T PP E OO 2

X2 DDF F Y J W Q 

..

```

---

I would like to equivalent of wat is possible in vi editor (:%s/\n+/ /g)

Searching the web I found a solution, which logically should have worked

> 
> sed -e '{:a; N; s/\n+/ /g; ta}' infile
> 
> 
> 

But this command defies my understanding and logic, and has produced output

```
X1 A B C D E F

\+ G H I J 1 LK T PP E OO 2
X2 DDF F Y 

\+ J W Q 

```

....

Any ideas are welcome, & Thanks in advance

Srisurya