LQ Newbie
Registered: Nov 2015
Posts: 1
Rep:
|
merge columns from multiple files in a directory based on match of two columns
Hi all,
I want to merge columns from multiple files(each file may have different number of columns and different column headers but only two headers in common) in a directory based on match of two common columns.Below are the sample files
file1
NAME,Time,Rx_bytes,Tx_bytes,SNR
a,11:01:00,1,2,,
c,11:01:00,3,4,5
e,11:01:00,6,,
file2
NAME,Time,Speed,RPM
g,11:01:00,34,56
i,11:01:00,45,55
a,11:02:00,45,65
file3
NAME,Time,Cycles,Errors,BW
c,11:01:00,2,3,4
e,11:01:00,32,21,34
a,11:01:00,68,79,
g,11:01:00,33,44,
k,11:01:00,23,34,54
...and so on some files like this
I need the output like this
result_file1.csv
NAME,Time,Rx_bytes,Tx_bytes,SNR,Speed,RPM,Cycles,Errors,BW
a,11:01:00,1,2,,,,68,79,
a,11:02:00,,,,45,65,,,
result_file2.csv
NAME,Time,Rx_bytes,Tx_bytes,SNR,Cycles,Errors,BW
c,11:01:00,3,4,5,2,3,4,32,21,34
result_file3.csv
NAME,Time,Speed,RPM,Cycles,Errors,BW
e,11:01:00,6,,
result_file4.csv
NAME,Time,Speed,RPM,Cycles,Errors,BW
g,11:01:00,34,56,33,44,
and so on like this.
I want to form result files based on the column 'NAME' and with sorted 'TIME'
Thanks in advance
|