merging tab delimited txt files based on column (which is header ) in bash?

Im having two text files which contains million records , all the records are tab delimited , how we can merge these two files based on same header(column)?

file:1

    LogEntryTime              nameId       PartnerId        
    2021-06-05T15:00:53 07    5lsddf        qyutxwr 
        
        

file:2

        nameId  GroupId  compnayId
        5lsddf  l4buafm   0rd33cs               
    

output like this:

    LogEntryTime              nameId       PartnerId    GroupId  compnayId
    2021-06-05T15:00:53 07    5lsddf        qyutxwr     l4buafm   0rd33cs

Tried this but not working:

paste file1.txt file2.txt | nameId -s $'t' -t

and

cat file1.txt file2.txt |  awk -F 't' '{print $ list the all columns name here}'

awk one which is working but need to mention all the column numbers there.

is there any other solution help me out.

thanks in advance


Go to Source of this post
Author Of this post: Vamshi Krishna CH
Title Of post: merging tab delimited txt files based on column (which is header ) in bash?
Author Link: {authorlink}