I have two different files with one column each. The file 1 has more info and I want a command to search the matches against the file 2 and then return the original file 1 with an extra column saying for example matchFile 1Mg_134Mg_560File 2Mg_1Mg_134OutputMg_134 matchMg_560I tried to use join and grep -Ff, but I would like to have this specific output. Thanks
Compare two files and print matches in the first file adding extra column
file comparison
That should be a pretty standard task for awkawk 'NR==FNR {a[$1]++; next} $1 in a {$2=match}1' File2 File1Mg_134 matchMg_560