issue when using join

dear friends,

attached are two sorted files. I want to merge them using key column: Column #2 in first file and column #1 in the second file. I want to show all columns in the merged output file.

my code used is:
join -a1 -a2 -1 2 -2 1 -o 1.1 1.2 1.3 2.1 uncontrols2_by_ilmn_gene.txt ourgene_sort.txt>ourgene_anno.txt

but then i will get an output which the column in the 2nd file are in seperate row in the output file. any idea on how to modify the code?

Thanks a lot!

These files are Windows text files full of carriage-return garbage and won't work properly with non-Windows tools until they're fixed.

tr -d '\r' < wingarbage > normaltext

I didn't check the files or your code, but maybe you have problem with Windows line ends? Try running

dos2unix uncontrols2_by_ilmn_gene.txt ourgene_sort.txt

before running join.

it works. thanks a lot!

---------- Post updated at 10:29 AM ---------- Previous update was at 10:28 AM ----------

when I run it, I got error:
-bash: dos2unix: command not found

Not everyone has dos2unix, but everyone has tr.