<p>If the first column is always the same:</p>

<ul>
<li><a href="https://stackoverflow.com/a/33073145/680068">R cbind in a loop</a></li>
<li>bash <code>paste file*.txt</code></li>
</ul>

<p>If the first columns in not same:</p>

<ul>
<li><a href="https://stackoverflow.com/q/8091303/680068">R merge in a loop</a></li>
<li><a href="https://stackoverflow.com/q/13710876/680068">bash Merge multiple files by common field</a></li>
</ul>

CC BY-SA 4.0
2020-03-24T08:28:58.913Z
2020-03-24T08:28:58.913Z
zx8754
<p>I have 48 files in which I have</p>

<p>r1</p>

<pre><code>Organ-specific cancer signature Contribution
Esophagus_A 2948.114
Esophagus_B 815.6483
Esophagus_C 1278.381
Esophagus_D 883.5358
Esophagus_E 1446.103
Esophagus_F 880.0416
Esophagus_G 1262.907
Esophagus_H 743.2682
</code></pre>

<p>r2
..
r15</p>

<p>and</p>

<p>Non_res1</p>

<pre><code>Organ-specific cancer signature Contribution
Esophagus_A 2660.722
Esophagus_B 1471.017
Esophagus_C 1639.904
Esophagus_D 0
Esophagus_E 2580.775
Esophagus_F 946.3675
Esophagus_G 2013.654
Esophagus_H 0
</code></pre>

<p>...</p>

<p>Non_res33</p>

<p>I want a unified file in column one is Organ-specific cancer and 48 more columns are the second column of each separate file</p>

<p>How I can do that?</p>

CC BY-SA 4.0
2020-03-22T11:26:12.533Z
I don't want to insult any one honestly. In this question I am mentioning in output I have the common first column as the first column and second columns from each file :(
Zizogolu
<r><bash><awk>
Joinning columns from different files
# Joinning columns from different files

(Asked by: username_0 on 2020-03-21)

I have 48 files in which I have
r1
Organ-specific cancer signature Contribution
Esophagus_A 2948.114
Esophagus_B 815.6483
Esophagus_C 1278.381
Esophagus_D 883.5358
Esophagus_E 1446.103
Esophagus_F 880.0416
Esophagus_G 1262.907
Esophagus_H 743.2682

r2
..
r15
and
Non_res1
Organ-specific cancer signature Contribution
Esophagus_A 2660.722
Esophagus_B 1471.017
Esophagus_C 1639.904
Esophagus_D 0
Esophagus_E 2580.775
Esophagus_F 946.3675
Esophagus_G 2013.654
Esophagus_H 0

...
Non_res33
I want a unified file in column one is Organ-specific cancer and 48 more columns are the second column of each separate file
How I can do that?

**Tags:** r, bash, awk
> **Comments:**
> **username_0**: I don't want to insult any one honestly. In this question I am mentioning in output I have the common first column as the first column and second columns from each file :(  

---

## 1 answers

### Answer by username_1 on 2020-03-24. Score: 1

If the first column is always the same:

* [R cbind in a loop](https://stackoverflow.com/a/33073145/680068)
* bash `paste file*.txt`

If the first columns in not same:

* [R merge in a loop](https://stackoverflow.com/q/8091303/680068)
* [bash Merge multiple files by common field](https://stackoverflow.com/q/13710876/680068)


---

