i need merge these 2 sorted csv files on 'contract' column (which common both files):
file1.csv
data;client;contract
mar 04 2017;la00024;1-456
mar 04 2017;la00025;1-789
file2.csv
contract;pda
1-456;00024
1-789;00025
the output i'd unique table:
data;client;contract;pda
mar 04 2017;la00024;1-456;00024
mar 04 2017;la00025;1-789;00025
however using command
$ join -o 1.1 1.2 1.3 2.2 -t";" -1 3 -2 1 file1.csv file2.csv
the result line
$ data;client;contract;pda
the join doesn't return merge of titles input files? why act this?
sort files before join
.
join -o 1.1,1.2,1.3,2.2 -t ';' -1 3 -2 1 <(sort -n -t";" -k3 file1.csv) <(sort -n -t";" -k1 file2.csv)
ps: sample data, command in question worked me. required ,
in -o format
.
Comments
Post a Comment