Need Help Comparing two Files

I really need help on creating a script that does the following:

I have one file (File 1) with lines in the following format:

Name.maf score1 score2

I have a second file (File 2) with lines in the following format:

label start end Name

What I need to do is compare File 1 and File 2. When the Name matches, then I need to add the "label, "start" and "end" column's value of File 2 to the 2nd, third and fourth column of File 1 to get

Output

Name.maf label start end score1 score2

The trick here too is that what needs to match is only the Name, not the entire Name.maf. e.g. hello.maf and hello would be Name matches.

Any help would be very much appreciated! Thanks! :slight_smile:

Try searching this site for 'NR==FNR' and you should see many posts with similar requirements.