Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

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've split a large file with the split command from a terminal and copied it from a usb-stick to my macbook.

This results in couple of files named 'xaa', 'xab', 'xac'.

How do I merge them together again from within a terminal?

share|improve this question
up vote 8 down vote accepted
cat xaa > newfile
cat xab >> newfile
cat xac >> newfile

Basically using a single '>' operand send the output to a new file. using a double '>>' operand makes it append the contents to the end of an existing file (and also out of interest create it if it does not already exist.

If all your files are definitely in a neat alphabetical order, then you could use:

cat x* > newfile


cat xaa xab xac > newfile

in case the filenames aren't in alphabetical order.

share|improve this answer
You can also do cat xaa xab xac > newfile – binarybob Mar 13 '12 at 19:57
but of course, this sounds logical! :-) thanks! – Sander Versluys Mar 13 '12 at 20:01
It is the mac way after all. – bmike Mar 13 '12 at 23:20
@bmike More like the Unix way, am I right?! :) – Mathias Bynens Mar 26 '12 at 6:56

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.