Hi all!

I have hundreds of .csv files with the same dimensions and the same column 1 (gene_name). I would like to do an inner_join in the terminal (linux command line) in order to have a single matrix. 

This is the .csv files `head SRR*_matrix_tpm.csv`
```
==> SRR5488793_matrix_tpm.csv <==
gene_name       SRR5488793
NM_001042449.1  3752.38
NM_001043315.1  0
NM_001043316.2  1.31546
NM_001043358.1  0
NM_001043359.1  9.34679
NM_001043360.1  0.459982
NM_001043361.1  4.52898
NM_001043362.1  396.222
NM_001043363.1  101.929

==> SRR5488794_matrix_tpm.csv <==
gene_name       SRR5488794
NM_001042449.1  5352.09
NM_001043315.1  0.0205977
NM_001043316.2  3.23229
NM_001043358.1  0
NM_001043359.1  15.0625
NM_001043360.1  0.833219
NM_001043361.1  11.0039
NM_001043362.1  147.638
NM_001043363.1  22.1844

==> SRR5570692_matrix_tpm.csv <==
gene_name       SRR5570692
NM_001042449.1  5155.04
NM_001043315.1  1.74624
NM_001043316.2  18.6743
NM_001043358.1  0
NM_001043359.1  81.4916
NM_001043360.1  0
NM_001043361.1  16.1719
NM_001043362.1  34391.8
NM_001043363.1  3315.22
```
I would like to have something like this: 



```
==> matrix.csv <==
gene_name	SRR5488793	SRR5488794	SRR5570692
NM_001042449.1	3752.38	5352.09	5155.04
NM_001043315.1	0,0	0.0205977	174624,0
NM_001043316.2	131546,0	323229,0	186743,0
NM_001043358.1	0,0	0,0	0,0
NM_001043359.1	934679,0	150625,0	814916,0
NM_001043360.1	0.459982	0.833219	0,0
NM_001043361.1	452898,0	110039,0	161719,0
NM_001043362.1	396222,0	147638,0	34391.8
NM_001043363.1	101929,0	221844,0	3315.22
```
`Many thanks!`
Unix `join` command can only be used to join 2 tables together at a time. You will need a few piped commands to get the joined result.

```
$ join -1 1 -2 1 SRR5488793_matrix_tpm.csv SRR5488794_matrix_tpm.csv | tr ' ' '\t' | join -1 1 -2 1 - SRR5570692_matrix_tpm.csv | tr ' ' '\t' > joined.tsv`
$ cat joined.tsv 
gene_name	SRR5488793	SRR5488794	SRR5570692
NM_001042449.1	3752.38	5352.09	5155.04
NM_001043315.1	0	0.0205977	1.74624
NM_001043316.2	1.31546	3.23229	18.6743
NM_001043358.1	0	0	0
NM_001043359.1	9.34679	15.0625	81.4916
NM_001043360.1	0.459982	0.833219	0
NM_001043361.1	4.52898	11.0039	16.1719
NM_001043362.1	396.222	147.638	34391.8
NM_001043363.1	101.929	22.1844	3315.22
```
*EDIT: the above only works if the files are sorted for the 'key', in this case column 1*

If you have hundreds of files with the same length and order, you can use the `cut` command to create 

```
cut -f1 SRR5488793_matrix_tpm.csv > rownames.txt
for CSV in *csv ; do
  cut -f2 $CSV > $CSV.cut
done
paste rownames.txt *cut > joined.tsv
```

Alternatively in R there is a `join_all()` function in the `plyr` package.