Artificial intelligent assistant

How to obviate the problem of no spaces when joining lines in ed In ed it is easy to join lines together. For example, `12,13j` joins lines 12 and 13 `-1,.j` joins the line before to the current line However, ed does not add a space between the joined lines, and therefore one is often left with this situation: Line 1 Line 2 >Line1Line2 One could first add a space and then join the lines, as in, 1g/$/s// /\ 1,2j but this is somewhat cumbersome. Does anyone have a more elegant solution?

If you want to join the next line to the current line, I would proably use the two separate commands


s/$/ /
j


(The default address for `j` is `.,.+1`)

Add an address to the `s` command if you want to reposition the current line first.

The `g` command is only really needed here if you want to be able to undo _both_ edits with `u`:


.g/$/ s// /\
j


or, if you want to use some more elaborate criteria for what lines to join with the next line,


g/RE/ s/$/ /\
j

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy b0c19f7ad91be31db70d2adc0db771dd