Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to join columns of two files in unix system

Tags:

linux

shell

I have 2 files, each file has one column with multiple rows and the rows of each file are the same. How can I join the 2 files' columns together so that the final result file has two columns coming from file1 and file2?

For example, file1 is:

1
2
3

and file2 is:

a
b
c

and the expected output is:

1   a
2   b
3   c
like image 337
kiluer2005 Avatar asked Sep 11 '12 02:09

kiluer2005


1 Answers

Just use the paste command. Use it like this : paste file1 file2

like image 55
jianpx Avatar answered Oct 24 '22 01:10

jianpx