Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to merge 2 text files into one (by appending the content of the second right after the first one) in Unix ?

share|improve this question
Not really a merge, you just append one file after another. – Johan Jun 11 '11 at 20:06
up vote 7 down vote accepted

Assuming bash as shell or bash script...

Append file2 to file1 (keeping file2 in original state):

cat file2 >> file1

Or this (keeping both original files around):

cat file1 file2 > new_merged_file

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.