Operating System - HP-UX
1833599 Members
3677 Online
110061 Solutions
New Discussion

File splitter/compression

 
SOLVED
Go to solution
mckiers
Occasional Advisor

File splitter/compression

I am looking for a hpux tool that does file compression and splits the file into a number of smaller files. Can anyone help?
3 REPLIES 3
SHABU KHAN
Trusted Contributor
Solution

Re: File splitter/compression

Hi,

The split command will split files.. for example:

>ls -l test.ksh
-rwxr-xr-x 1 skhan sysadmin 464 Mar 27 15:51 test.ksh

This file has 464 bytes, if you would like to split this into two then:

>split -b 232 test.ksh

will split the files into (the filenames will be xaa, xbb etc..):
>ls -la xa*
-rw-r--r-- 1 sxkhan sysadmin 232 Mar 28 15:29 xaa
-rw-r--r-- 1 sxkhan sysadmin 232 Mar 28 15:29 xab

If you want to compress the file, then:

>compresss test.ksh
-rwxr-xr-x 1 sxkhan sysadmin 329 Mar 27 15:51 test.ksh.Z

To uncompress:
uncompress test.ksh.Z
-rwxr-xr-x 1 skhan sysadmin 464 Mar 27 15:51 test.ksh

Hope this helps !

-Shabu
SHABU KHAN
Trusted Contributor

Re: File splitter/compression

Sorry, one more thing... to restore the split files back then do this :

> cat x* >

In our example:

> cat x* > test.ksh


-Shabu
Deepak Extross
Honored Contributor

Re: File splitter/compression

I like to use a combination of gzip / gunzip and split.

To compress & split:
gzip
split .gz

To consolidate and uncompress:
cat x* > .gz
gunzip .gz

See the man pages of gzip and split for details.