0

Good day. I am new to linux and really hope someone can help me.

I have two files:

File 1 : Column1=id_nr; Column2=snp_info

Column1=id_nr;  Column2=snp_info

File 2 : Column1=id_nr; Column2=recoded_id_nr

Column1=id_nr;  Column2=recoded_id_nr

I want to join the two files so that I end up with a file with Column1=recoded_id_nr and Column2=snp_info for animals (id_nr) present in File 1 and File 2. The id_nr are the matching variable and both files are sorted on it.

In linux I used the various forms of the join function, but get the same as the common one below:

join file1 file2

Result:

enter image description here

It gives the correct animals that are present in both files, but the problem is with the first column. The first integer is the correct recoded_id_nr, but it is fused (concatenated), without any space, with the last 8 digits of the id_nr of the 3 animals that are present in both files. Thus, it cuts of the first 2 digits of the id_nr and replace it with the recoded_id_nr. The second column (snp_info) is fine.

Any help would be immensely appreciated. Michiel

0 Answers0