Joining two files

join;text processing

I have a 2 files with the following:

File1.txt 
A 1
B 2
C 5
Z 3

File2.txt
A 4
B 7 
C 10
D 11

What I would like to do is create something like

A 1 4 
B 2 7
C 5 10
D - 11
Z 3 -

Is there a utility that does this? If not how Can this be done? Using a find and awk or something?

Best Answer

join -a1 -a2 -o 0,1.2,2.2 -e - file1.txt file2.txt
Related Question