I have two files having a primary key value as a first field, and a corresponding value(s) as the remaining fields, and some primary key values are missing in one of them but are present in another, and vice versa:
$ cat jointest1.txt jointest2.txt
a 1
b 2
d 4
e 5
a 10
b 11
c 12
d 13
I'd expect an output that merges those files according to a primary key, either substituting the missing values or not, like:
$ joinmerge jointest1.txt jointest2.txt
a 1 10
b 2 11
c - 12
d 4 13
e 5 -
Ability to replace missing values with dashes or something is optional.
I tried join, but it says my files are not properly sorted:
$ join jointest1.txt jointest2.txt
a 1 10
b 2 11
join: file 2 is not in sorted order
d 4 13
What command should I use instead?