Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bind two files by column in bash

Tags:

bash

cbind

when i have two files such as file A

012
658
458
895
235

and file B

1
2
3
4
5

how could they be joined in bash? The output shoudl just be

1012
2658
3458
4895
5235

really I just want to bind by column such as in R (cbind).

like image 625
user3419669 Avatar asked Dec 15 '22 22:12

user3419669


1 Answers

Assuming columns are in equal length in both files, you can use paste command:

paste --delimiters='' fileB fileA

The default delimiter for paste command is TAB. So '' make sure no delimiter is in place.

like image 161
P.P Avatar answered Dec 30 '22 06:12

P.P