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

I have two files: one is like

chapter 1

the other is like


I was wondering how to column-wise combine the two files into one:

preface 1
Introduction 2
chapter 1 3

by using some utilities, such as awk, sed, available in Ubuntu?

Thanks and regards!

share|improve this question
For such file manipulation I would look for the join command. It requires a common field though, but you could add one like line number, no ? – Julien Jul 7 '11 at 14:08
@Julien: How do you do with join? – Tim Jul 7 '11 at 14:36
up vote 7 down vote accepted
paste fileone filetwo

Use -d to specify delimiter.

share|improve this answer
Thanks! I just found that pr -t -m firstfile secondfile can also do the similar job. Are there differences between the two methods? – Tim Jul 7 '11 at 18:31

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.