Split & Merge Files in Solaris

Split a large file

-rw-r--r--   1 itsiti     other        12M April 3 03:45 test.zip
# split -b 3m test.zip splitfile
# ls -lrt splitfile*
-rw-rw-r--   1 itsiti     other       4.0M April 3 03:50 splitfileaa
-rw-rw-r--   1 itsiti     other       4.0M April 3 03:50 splitfileab
-rw-rw-r--   1 itsiti     other       4.0M April 3 03:50 splitfileac</pre>
 

Note:

split [-b nm] [file [name]]

• -b nm : splitting a file into pieces of size nMB.
• file : the file to be split.
• name : the name for each file after split operation.

Merge files into a file. (2 way)

a. One file at a time

# cat splitfileaa > test1.zip
cat splitfileab >> test1.zip
cat splitfileac >> test1.zip

b. All files at once

# cat splitfile* > test1.zip

You May Also Like

Leave a Reply?