Operating System - Linux
1829107 Members
2346 Online
109986 Solutions
New Discussion

How to join or combine 2 files by column ?

 
SOLVED
Go to solution
Sammy_2
Super Advisor

How to join or combine 2 files by column ?

# ==> cat test1
John
pat
george

# ==> cat test2
kerry
edwards
bush

How do I join/combine 2 files so it looks like this:
# cat test3
John Kerry
Pat Edwards
George Bush


Thanks
good judgement comes from experience and experience comes from bad judgement.
5 REPLIES 5
Sammy_2
Super Advisor

Re: How to join or combine 2 files by column ?

Please ignore the lower/upper case in last file (test3). I am just trying to combine 2 files.
good judgement comes from experience and experience comes from bad judgement.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: How to join or combine 2 files by column ?

paste test1 test2 > test3

Man paste for details.
If it ain't broke, I can fix that.
James George_1
Trusted Contributor

Re: How to join or combine 2 files by column ?

# paste file1 file2 > file3

Rgds/ James
forum is for techies .....heaven is for those who are born again !!
Sandman!
Honored Contributor

Re: How to join or combine 2 files by column ?

# paste -d " " file1 file2

...to separate the merged cols with a space instead of the default character. See the manpage of paste(1) for details.
Sammy_2
Super Advisor

Re: How to join or combine 2 files by column ?

Thanks paste command works great.
good judgement comes from experience and experience comes from bad judgement.