I have two files with tab-seperated values that look like this:file1:A    1B    3C    1D    4file2:E    1B    3C    2A    9I would like to find rows between files 1 and 2 where the string in column 1 is the same, then get the corresponding values. The desired ouput is a single file that looks like this:B    3    3C    1    2A    1    9Can this be done with a Unix one-liner?
Find common elements in a given column from two files and output the column values from each file
awk;join;comm
GNU coreutils includes the command join that does exactly what you want if line sorting in the result is irrelevant:join <(sort file1) <(sort file2)A 1 9B 3 3C 1 2If you want the tabs back, do:join <(sort file1) <(sort file2) | tr ' ' '\t'A   1   9B   3   3C   1   2Or use the t option to join.(<() aka process substitution, requires ksh93 (where the feature originated in), bash or zsh)