- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- gzip append to a file
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 01:11 AM
тАО04-14-2011 01:11 AM
gzip append to a file
For example
I gzip the file aa.txt to file.gz , after 1 hour , I will gzip another file bb.txt to file.gz , 2 minutes later , I will gzip the file cc.txt to file.gz ...
I know tar can do that , can advise if gzip can also do that ?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 04:48 AM
тАО04-14-2011 04:48 AM
Re: gzip append to a file
according to the man page all you would have to do is compress the files you want and then append them together, like this:
gzip -c file1 > foo.gz
gzip -c file2 >> foo.gz
Rick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 05:47 AM
тАО04-14-2011 05:47 AM
Re: gzip append to a file
According to _what_ on which "man" page? Did
you try this? (Where "try this" includes
trying to recover the original files.) Did
it work?
When I tried it, the result was a
concatenation of the original files, not a
set of files like the original files. For
example:
dyi # ls -l ../*t.c
-rw-r--r-- 1 root sys 142 Nov 1 2008 ../cst.c
-rw-r--r-- 1 root sys 234 Oct 27 06:28 ../rt.c
dyi # rm *
dyi # ( cd .. ; gzip -c cst.c ) > fred.gz
dyi # ( cd .. ; gzip -c rt.c ) >> fred.gz
dyi # ls -l
total 16
-rw-r--r-- 1 root sys 314 Apr 13 22:20 fred.gz
dyi # gzip -dN fred.gz
dyi # ls -l
total 16
-rw-r--r-- 1 root sys 376 Oct 27 06:28 cst.c
dyi #
(Note that 142 + 234 = 376.)
> I know tar can do that, [...]
You know that "tar" can do what, exactly?
(As usual, a demonstration would be a good
way to explain that.)
If I understand the request correctly, then
a program like Info-ZIP Zip may be suitable.
dyi # rm *
dyi # pwd
/root/itrc/gzipt
dyi # ( cd .. ; zip gzipt/fred.zip cst.c )
adding: cst.c (deflated 15%)
dyi # ( cd .. ; zip gzipt/fred.zip rt.c )
adding: rt.c (deflated 37%)
dyi # unzip fred.zip
Archive: fred.zip
inflating: cst.c
inflating: rt.c
dyi # ls -l
total 48
-rw-r--r-- 1 root sys 142 Nov 1 2008 cst.c
-rw-r--r-- 1 root sys 563 Apr 13 22:26 fred.zip
-rw-r--r-- 1 root sys 234 Oct 27 06:28 rt.c
Zip is a more comprehensive archiving utility
than "gzip". (And it compresses better than
plain "tar".) It's intended to be able to
put multiple input files into one archive,
possibly at different times. (Its archives
include a kind of "table of contents", which
it updates when it adds a new file to an
existing archive.) If gzip can do anything
like that, then it's news to me.
For the record:
dyi # uname -a
HP-UX dyi B.11.31 U ia64 4235313755 unlimited-user license
dyi # zip -v
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
[...]
dyi # unzip -v
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
[...]
http://www.info-zip.org/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 05:56 AM
тАО04-14-2011 05:56 AM
Re: gzip append to a file
to aapend to gzip,
gunzip
append
gzip
is the only way I know.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 05:16 PM
тАО04-14-2011 05:16 PM
Re: gzip append to a file
I tried parameter -c , but I found that the data will be append to the previous file , when I extract the zipped file , all data will be conbined into one single file .
If I only want the file append to previous file eg. if I append 10 files to it , the output should be 10 files , what can i do ? Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 06:01 PM
тАО04-14-2011 06:01 PM
Re: gzip append to a file
Use Zip instead of gzip?
Did you read these replies?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 06:16 PM
тАО04-14-2011 06:16 PM
Re: gzip append to a file
because the server do not have zip package , we do not want to install package to it ( because some reasons ), so we want to use gzip.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-14-2011 06:39 PM
тАО04-14-2011 06:39 PM
Re: gzip append to a file
That's pretty easy to fix.
> we do not want to install package to it
> ( because some reasons ),
Any _good_ reasons?
> so we want to use gzip.
If you want to use gzip, then don't let me
stop you. I want gzip to fill my pockets
with gold coins, but I suspect that gzip
can't do that, either.
I'll tell you what. If I find a way to get
gzip to do what you want, I'll let you know.
If you find a way to get it to do what _I_
want, you let me know. I won't be holding my
breath. You probably shouldn't be holding
yours, either.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2011 03:08 AM
тАО04-16-2011 03:08 AM
Re: gzip append to a file
Then you'll need to continually gunzip a tar add to the tar and gzip.
While gnu tar has a -z option, I'm not sure if it allows to to append when you use -z?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-16-2011 04:23 PM
тАО04-16-2011 04:23 PM
Re: gzip append to a file
> if it allows to to append when you use -z?
http://www.gnu.org/software/tar/manual/
http://www.gnu.org/software/tar/manual/html_node/gzip.html
[...]
Notice also, that there are several
restrictions on operations on compressed
archives. First of all, compressed archives
cannot be modified, i.e., you cannot update
('--update', alias '-u') them or delete
('--delete') members from them or add
('--append', alias '-r') members to them.
Likewise, you cannot append another tar
archive to a compressed archive using
'--concatenate' ('-A'). Secondly,
multi-volume archives cannot be compressed.
[...]