Hi All,
I do have 2 files
file 1 has 4 tab delimited columns
234 a c dfgyu
294 b g fih
302 c h jzh
328 z c san
597 f g son
File 2 has 2 tab delimted columns
234 23
302 24
597 24
I want to merge file 2 with file 1 based on the data common in both files which is the first column so that I could get a tab delimited file such as:
234 a c dfgyu 23
302 c h jzh 23
597 f g son 25
Please let me know the best way to do this merging in awk or sed
Look into the comm command - does just what you want. The input files do have to be sorted with the column of interest as the primary key.
Define 'did not work'. What did you get for output - my crystal ball is in for repairs (sorry corona).
The comm command won't give me the output I needed since I am dealing with 1000's of lines in the 2 files. The files I shown was just for illustration.
cabrao
December 14, 2010, 3:38pm
6
Someone asked the same question today...
Have a look here: Join multiple files based on 1 common column
Please show exactly what you've tried so far.
Also at the bottom of this thread there's a list of the potential hints/other threads.
Also wasn't something very similar already answered in one of your own previous threads ?