我想加入2個文件 - 兩個文件都是CSV格式 - 兩個文件都有相同的列。下面是每個文件的例子:BASH - 加入非第一列
文件1:
CustName,AccountReference,InvoiceDate,InvoiceRefID,TelNo,Rental,GPRS,Mnet,MnetPlus,SMS,CSD,IntRoaming,NetAmount
acme,107309 ,2011-09-24 12:47:11.000,AP/157371,07741992165 ,2.3900,.0000,.0000,.0000,.0000,.0000,.0000,2.3900
acme,107309 ,2011-09-24 12:58:32.000,AP/162874,07740992165 ,2.0000,.0000,.0000,.0000,.0000,.0000,.0000,2.0000
anot,107308 ,2011-09-24 12:58:32.000,AP/162874,07824912428 ,2.0000,.0000,.0000,.0000,.0000,.0000,.0000,2.0000
anot,107308 ,2011-09-24 12:47:11.000,AP/157371,07834919928 ,1.5500,.0000,.0000,.0000,.0000,.0000,.0000,1.5500
文件2:
CustName,AccountReference,InvoiceDate,InvoiceRefID,TelNo,Rental,GPRS,Mnet,MnetPlus,SMS,CSD,IntRoaming,NetAmount
acme,100046,2011-10-05 08:29:19,AB/020152,07824352342,12.77,0.00,0.00,0.00,0.00,0.00,0.00,12.77
anbe,100046,2011-10-05 08:29:19,AB/020152,07741992165,2.50,0.00,0.00,0.00,0.00,0.00,0.00,2.50
acve,100046,2011-10-05 08:29:19,AB/020152,07740992165,10.00,0.00,0.00,0.00,0.00,0.00,0.00,10.00
asce,100046,2011-10-05 08:29:19,AB/020152,07771335702,2.50,0.00,0.00,0.00,0.00,0.00,0.00,2.50
我想2個文件結合在一起 - 而只是採取了一些列的其他列可以忽略(有些是相同的,有些是不同的) -
AccountRef,telno, rental_file1,rental_file2,gprs_file1,gprs_file2
etc etc ...
連接應該在telno
列上完成(看起來我在文件1中有空白 - 希望可以忽略?
我發現很多使用JOIN
例子,但它們都使用了第一列了對連接的關鍵....任何指針將是巨大的 - 感謝
AccountRef應該來自file1還是來自file2?每個文件的telnums是唯一的嗎? –
@DimitreRadoulov AccountRef應取自file1(對不起沒有清楚上面),是的telno的每個文件是唯一的....感謝 – ManseUK