1754326 Members
2865 Online
108813 Solutions
New Discussion юеВ

joining files

 
SOLVED
Go to solution
steven Burgess_2
Honored Contributor

joining files

Hi

If I have 2 files

file1

Mon
Tues
Wed
Thurs

file2

1st
2nd
3rd
4th

How can I join the files together so they become

file3

Mon 1st
Tues 2nd
Wed 3rd
Thur 4th


Thanks in advance

Steve
take your time and think things through
5 REPLIES 5
Ron Kinner
Honored Contributor
Solution

Re: joining files

paste file1 file2 > file3

ought to do it. Check the man for options or paste -h.

Ron
steven Burgess_2
Honored Contributor

Re: joining files

Cheers

I was looking at the join command and getting frustrated

10 points for that man

Steve
take your time and think things through
John Carr_2
Honored Contributor

Re: joining files

John

cat file1 >> file2

this will append file2 to file1

cheers
John
John Carr_2
Honored Contributor

Re: joining files

Hi please ignore ths last suggestion I didnt read the question properly.

John.
Joseph A Benaiah_1
Regular Advisor

Re: joining files

Steven,

You can also use the pr command as follows:

pr -m -t -s' ' file1 file2 > file3.

The -m option allows you to merge the files and the -s flag is the field serperator.

Cheers,

Joseph.