Search code examples
linuxmergevi

How to merge multiple files into one line by line?


I have 4 files

**File1**          **File2**        **File3**        **File4**
alpha              this             security         rain 
beta               that             performance      go 
gamma              an               auto             away
.                  .                .                .    
.                  .                .                .
.                  .                .                .
[25000 rows]       [25000 rows]     [25000 rows]     [25000 rows]

I want these 4 files to be combined together in the resultfile as ResultFile

alpha
this
security
rain
beta
that
performance
go
.
.
.
[75000 rows]

how can I do that in vi?


Solution

  • Use paste:

    paste -d "\n" file1 file2 file3 file4