1834144 Members
2237 Online
110064 Solutions
New Discussion

Combining files

 
SOLVED
Go to solution
Ted Flanders
Frequent Advisor

Combining files

I need help combining file1 with file2. Can someone tell me the command? I want to make file3 out of 1 & 2 and be able to go in and sort the combined info.
4 REPLIES 4
Patrick Wallek
Honored Contributor
Solution

Re: Combining files

This is relatively easy. Do a:

cat file1 file2 > file3

That will just combine the 2 files. If you want to sort at the same time:

cat file1 file2 | sort > file3
Ted Flanders
Frequent Advisor

Re: Combining files

Thanks Patrick, I knew it was simple but I couldnt find the command quick enough. I actually used

sort -u -o file3 file2 file1


and got the desired results. The cat command is the one that I was looking for.
MANOJ SRIVASTAVA
Honored Contributor

Re: Combining files

Hi Ted

You can also append

like

cat fileA > file C
cat fileB >> file C

Manoj Srivastava
Steve Post
Trusted Contributor

Re: Combining files

How about copying SIDEWAYS. To put file1 to the left, and file2 to the right you could do this:
paste file1 file2 > file3.