awk '{FS="|"}{OFS="|"}
NR==1{for(i=1;i<NF;++i)n1=" na"n1}
NR==FNR{a1[$1]=substr($0,length($1+$2+$3+$4+$5)+1);t[$1];next}
FNR==1{for(i=1;i<NF;++i)n2=" na"n2}
{a2[$1]=substr($0,length($1+$2+$3+$4+$5)+1);t[$1];next}
END{for(i in t)print i (i in a1 ? a1[i] : n1) (i in a2 ? a2[i] : n2) | "sort"}
'...
Hi,
Could anyone help with command wher i need to merge two file with variable number of records based on matching records
File1
*******
F1|F2|F3|F4|F5|F6|F7|F8|F9|F10|F11|F12
..
..
..
N records
File2
*****
F1|F2|F3|F4|F5|F13|F14|F15
..
..
..
M Records
I need the output as
File3...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.