I have two files that I am trying to compare, and create a final.txt file with data that exists from both of those files.
File1 - column 1 and File2 - columns 2 contain the value that I need to match between the two files.
So essentially, I am trying to -> take column1 from File1, if there is a match in column2 of file2, then write File1Column1, File1Column2 and File2Column1 to a new file called final.txt.
EXAMPLE
File 1
1000,Brian
1010,Jason
400,Nick
File 2
3044 1000
4466 400
1206 1010
Final.txt file to look like
1000,Brian,3044
1010,Jason,1206
400,Nick,4466
I believe I should be able to do this with awk, but for some reason I am really struggling with this one. Any help would be greatly appreciated.
Thanks
join
approach is not quite as straightforward as it might have been since the files have different delimiters. Quite doable, of course, just not all that simple.awk
. I bet this is a duplicate or almost a duplicate (if it wasn't for the different delimiter which isn't a big deal imo)...