Question

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?

Was it helpful?

Solution

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

or

cat xaa xab xac > newfile

in case the filenames aren't in alphabetical order.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top