How to split a large file or join files use command line on Mac OS?

How to split a large file and join files use command line on Mac OS?

1 - split a too large file

Example, split a large file 500mb

split -b 300m /sources/fileExample.xyz /ouput-folder/fileExample.xyz
# 300m = 300mb
# results: fileExample.xyzaa (~300mb) fileExample.xyzab (~200mb)


Use the -b flag to separates by size (bytes). Ex: Splitting it in files of 1MB, we just use 1m
Use the -l flag to separated the files by a number of lines


2 - join files into one:

 cat fileExample.xyz* > fileExample.xyz

# or 
 
 cat fileExample.xyzaa fileExample.xyzab > fileExample.xyz
 
# result: fileExample.xyz (500mb) 


© 2019 4codev

Created with love by Sil.