file1 :HOUSAM1189870            3      0.00   0  -2450.00  11HOUSAM1213135            3      0.00   0  -2620.00   2HOCANM245675             3      0.00   0      0.00   0HOUSAM1239242            3      0.00   0  -3113.00   8file2 :AY840F3001138842 20050301AY840F3001140253 20060101HOCANM245675     34409887        HOUSAM1239242    34444444I want to join file1 and file2 based on common rows of their first column. therefore the output should be:file3:HOCANM245675             3      0.00   0      0.00   0 34409887HOUSAM1239242            3      0.00   0  -3113.00   8 34444444any suggestion, please ?
How to join 2 files based on common rows of first columns?
shell;join;merge
(note: this answer was written before the question was updated with the join command and the error messages)the command is called join.from the man page:join - join lines of two files on a common fieldsince your input files are not sorted you need to sort them firstjoin <(sort file1) <(sort file2)the <(...) things are called process substitution and is supported by bash and some other shells. if you have a shell that does not support process substitution then you have to work with intermediate files.join is part of the gnu coreutils so it should be installed on most common gnu/linux systems.