How do I join two lines in vi?

Shift+J removes the line change character from the current line, so by pressing "J" at any place in the line you can combine the current line and the next line in the way you want.


Vi or Vim?

Anyway, the following command works for Vim in 'nocompatible' mode. That is, I suppose, almost pure vi.

:join!

If you want to do it from normal command use

gJ

With 'gJ' you join lines as is -- without adding or removing whitespaces:

S<Switch_ID>_F<File type>
_ID<ID number>_T<date+time>_O<Original File name>.DAT

Result:

S<Switch_ID>_F<File type>_ID<ID number>_T<date+time>_O<Original File name>.DAT

With 'J' command you will have:

S<Switch_ID>_F<File type> _ID<ID number>_T<date+time>_O<Original File name>.DAT

Note space between type> and _ID.


This should do it:

J