Hello experts,
Please help me in achieving this in an easier way possible. I have 2 csv files with following data:
File1
08/23/2012 12:35:47,JOB_5330
08/23/2012 12:35:47,JOB_5330
08/23/2012 12:36:09,JOB_5340
08/23/2012 12:36:14,JOB_5340
08/23/2012 12:36:22,JOB_5350
08/23/2012 12:36:26,JOB_5350
File2
JOB_5340,121648
JOB_5350,121648
JOB_5360,243215
Output Required
08/23/2012 12:35:47,JOB_5330
08/23/2012 12:35:47,JOB_5330
08/23/2012 12:36:09,JOB_5340,JOB_5340, 121648
08/23/2012 12:36:14,JOB_5340
08/23/2012 12:36:22,JOB_5350,JOB_5350,121648
08/23/2012 12:36:26,JOB_5350
I have tried to construct this code, and it doesn't produces the exact match on the 4th column. Here is the code and the output...
awk -F, 'NR==FNR { a[$2]=$0; next }
> a[$3] { print $0, a[$3]}
> ' Aug_23.log.Data_load.csv Aug_23.log.begin_end_times.csv
08/23/2012 12:35:47,JOB_5330 JOB_5490 24
08/23/2012 12:35:47,JOB_5330 JOB_5490 24
08/23/2012 12:36:09,JOB_5340 JOB_5490 24
08/23/2012 12:36:14,JOB_5340 JOB_5490 24
08/23/2012 12:36:22,JOB_5350 JOB_5490 24
08/23/2012 12:36:26,JOB_5350 JOB_5490 24
08/23/2012 13:08:51,JOB_5360 JOB_5490 24
08/23/2012 13:08:58,JOB_5360 JOB_5490 24