I have two massive text files containing more than 10000 lines.
I need to make from them a new file that contains a line from each file.
File1 line a line b line c
File2 line 1 line 2 line 3
output
New File line a line 1 line b line 2 line c line 3
I have two massive text files containing more than 10000 lines.
I need to make from them a new file that contains a line from each file.
File1 line a line b line c
File2 line 1 line 2 line 3
output
New File line a line 1 line b line 2 line c line 3
Simply with paste command:
paste -d'\n' file1 file2 > result
-d'\n' - use newline character \n as delimiter between corresponding merged items/lines$ cat result
line a
line 1
line b
line 2
line c
line 3
Using awk:
$ awk '1; { getline <"file1" } 1' file2
line a
line 1
line b
line 2
line c
line 3
or, more verbosely,
$ awk '{ print; getline <"file1"; print }' file2
line a
line 1
line b
line 2
line c
line 3