I have a two files. File 1 looks like this:
a 1
b 6
c 8
The second file is:
a 2
b 4.5
c 3.8
I want to merge file 1 and file 2 in a way that always outputs:
a 1
a 2
b 6
b 4.5
c 8
c 3.8
I have a two files. File 1 looks like this:
a 1
b 6
c 8
The second file is:
a 2
b 4.5
c 3.8
I want to merge file 1 and file 2 in a way that always outputs:
a 1
a 2
b 6
b 4.5
c 8
c 3.8
According to this Stack Overflow answer, you can do:
awk '{print; if(getline < "file2") print}' file1
Depending on how you want them to be interleaved, you could also try cat file1.txt file2.txt | sort > files.txt