bash - unix join, trying to do an outer join -


i trying outer join 2 csv files reason code joining first line , not whole file.

csv1.csv:

enter image description here

csv2.csv:

enter image description here

as shown have common fields , not. outer join these 2 files. fine having blank values values don't exist. tried http://www.theunixschool.com/2012/01/join-command.html code doesn't seem working me.

for example: enter image description here

i not sure why joining first row. tried: join -t"," -1 1 csv1.csv csv2.csv , got same result. , -a1 or -a2 returns whole csv file except first row. don't quite understand why unmatched. can help?

i spent couple hours on , seems not making progress.

thanks in advance

if join -t"," -1 1 -a1 -a2 csv1.csv csv2.csv

i joined header followed csv2 + nonexisting fields @ csv1 added.

i confused.

use database if want utilize database operations.

#!/bin/bash  sqlite3 ./temp.db <<eof | sort >joined.csv create table (name varchar(50), port1 real, port2 real, avg real); create table b (name varchar(50), port1 real, port2 real, avg real); .mode csv .import csv1.csv .import csv2.csv b select a.name,a.port1,a.port2,a.avg,b.port1,b.port2,b.avg left outer join b on a.name = b.name union select b.name,a.port1,a.port2,a.avg,b.port1,b.port2,b.avg b left outer join on b.name = a.name; eof  rm ./temp.db 

Comments