Split a file into multiple files and combine again

Split a file into multiple files and combine again

You need to be in a directory in which you want to split
The command below will create smaller files and postfix a alphabets for smaller files. You can change the size according to your needs.

split -b 10m "file-to-split.sql.gz" "file-to-split.sql.gz.part-"

Finally, when you want to join the split files.

cat file-to-split.sql.gz.part-* > file-to-split.sql.gz

You can also individually combine files by this command

cat file-to-split.sql.gz.part-aa file-to-split.sql.gz.part-ab

 

Share this post

Leave a Reply

Your email address will not be published. Required fields are marked *