I need to make a "mixture" of 2 files :
file1 :
123486:120fds
123486:121regd
123486:123gre
123486:124fds
123486:125fds
874135:120fds
874135:121ret
874135:122uyt
874135:123fds
874135:125fds
454631:120fds
454631:121fds
454631:122uyt
454631:123fds
454631:124fds
895230:121fds
895230:122juyr
895230:123fds
895230:124fds
GFDQGRE:121fds
GFDQGRE:122juyr
file2 :
FDQAF-123486 ;gfqdgfd
GREAG-874135 ;gfeytht
GFDQGRE-GFDQGRE ;htrzez
GFDQGRTRE-454631 ;oeroeioz
GFDGTRYT-GFDGTRYT ;rtreatra
GFQ4TR-895230 ;gtrzopo
what I want to obtain :
file 3 :
FDQAF-123486 gfqdgfd 120fds 121regd 123gre 124fds 125fds
GREAG-874135 gfeytht 120fds 121ret 122uyt 123fds 125fds
GFDQGRTRE-454631 oeroeioz 120fds 121fds 122uyt 123fds 124fds
GFQ4TR-895230 gtrzopo 121fds 122juyr 123fds 124fds
GFDQGRE-GFDQGRE htrzez 121fds 122juyr
what I must do is to find the part in red of file2 in the 1st field of file1. If it matches then replace field 1 of file1 by the line of file2. the ";" must be deleted and I need to concatenate all the lines where the field 1 of file1 is the same without repeating the 1st field. The different fields must be ordered in columns. The "120" must be in the same column and if there is no "120" I must put a blank.
I think I need to use awk but it's too hard for my small experience...
I hope it's clear enough. thanks for your help.
file1 :
123486:120fds
123486:121regd
123486:123gre
123486:124fds
123486:125fds
874135:120fds
874135:121ret
874135:122uyt
874135:123fds
874135:125fds
454631:120fds
454631:121fds
454631:122uyt
454631:123fds
454631:124fds
895230:121fds
895230:122juyr
895230:123fds
895230:124fds
GFDQGRE:121fds
GFDQGRE:122juyr
file2 :
FDQAF-123486 ;gfqdgfd
GREAG-874135 ;gfeytht
GFDQGRE-GFDQGRE ;htrzez
GFDQGRTRE-454631 ;oeroeioz
GFDGTRYT-GFDGTRYT ;rtreatra
GFQ4TR-895230 ;gtrzopo
what I want to obtain :
file 3 :
FDQAF-123486 gfqdgfd 120fds 121regd 123gre 124fds 125fds
GREAG-874135 gfeytht 120fds 121ret 122uyt 123fds 125fds
GFDQGRTRE-454631 oeroeioz 120fds 121fds 122uyt 123fds 124fds
GFQ4TR-895230 gtrzopo 121fds 122juyr 123fds 124fds
GFDQGRE-GFDQGRE htrzez 121fds 122juyr
what I must do is to find the part in red of file2 in the 1st field of file1. If it matches then replace field 1 of file1 by the line of file2. the ";" must be deleted and I need to concatenate all the lines where the field 1 of file1 is the same without repeating the 1st field. The different fields must be ordered in columns. The "120" must be in the same column and if there is no "120" I must put a blank.
I think I need to use awk but it's too hard for my small experience...
I hope it's clear enough. thanks for your help.