1

I have multiple files in format: chr position value.

I want to combine them in format "chr", "position", "samp1", "samp2", "samp3", "samp4",........

For example:

Samp1:

chromosome position value

1   3774318 1

1   3774319 1

1   3775200 2

1   3775201 7

1   3775202 70

1   3775203 7

1   3775204 270

1   3775205 3

1   3775206 5

Samp 2:

chromosome position value

1   3775200 1

1   3775201 1

1   3775202 10

1   3775203 1

1   3775204 12

1   3775205 1

1   3775206 13

1   3775207 1

1   3775208 1

1   3775209 18

and so on ....

Desired output file:

chr, position, value-samp1, value-samp2, value-samp3, value-samp4

I put random values in the output file

1 50204 2 17 5 2

1 50205 2 17 5 2

1 50206 2 18 5 2

1 50207 2 19 5 3

1 50208 3 19 5 3

1 50209 3 19 5 3

I tried join, merge, cat, but it does not work as I expected. I am a begginer. Do you have any ideas how it can be done?

closed as off-topic by steeldriver, ubfan1, Eliah Kagan, Kulfy, karel Nov 8 at 17:17

  • This question does not appear to be about Ubuntu within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • It's not clear what you want to achieve. Could you post an example of the input files and then an example of the output file you desire? – guillermo chamorro Nov 8 at 15:07
  • Thank you for commenting, I updated my post. – B.Germ Nov 8 at 15:14
  • Input files contain columns chromosome, position and value. Output file should contain chromosom, position, value-samp1, value-samp2, value-samp3, value-samp4 and so on. File are not of equal lenghth, so in one file position can be present, in another does not need to, in that case 0 should be written. – B.Germ Nov 8 at 15:50
  • 3
    Now apparently crossposted: unix.stackexchange.com/questions/551162/… – steeldriver Nov 8 at 16:08
  • 6
    I'm voting to close this question as off-topic because it has been re-posted on a more appropriate site – steeldriver Nov 8 at 16:14