Sponsored Content
Full Discussion: Appending a GZIP File
Top Forums Shell Programming and Scripting Appending a GZIP File Post 302369644 by ggs on Monday 9th of November 2009 08:15:53 AM
Old 11-09-2009

As far as I know, your first command (zcat ... | gzip > d.gz) - 'cat's all the three compressed files - then compresses it, one after another and save it to a single file named d.gz.

In second case, you read a compressed file and append it to a file named d.gz. d.gz is NOT compressed. Adding a 'gz' to a file name does not compresses it.


10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I send a file as an attachment (gzip file) on a Unix system

Hi, How do I send a file as an attachment (gzip file) on a Unix system ? Using sendmail. Please help me. :confused: (3 Replies)
Discussion started by: lacca
3 Replies

2. Solaris

script for Gzip thousands of file

Hi experts, I have thousands of file (data file and Gziped file) in same directory like below-- bash-2.05$ pwd /home/mmc bash-2.05$ file PP023149200709270546 TT023149200709270546: gzip compressed data - deflate method bash-2.05$ file PP027443200711242320 TT027443200711242320: ... (10 Replies)
Discussion started by: thepurple
10 Replies

3. Solaris

gzip a file and append creation date stamp to file

I want to gzip a file and append the creation date to the end of the file. How can I accomplish this task. Basically they are log files which need a creation date stamp appended to make sure they do not overwrite other log files. -jack (3 Replies)
Discussion started by: jacktravine
3 Replies

4. Shell Programming and Scripting

appending the count of line in each file at head of each file

hello everybody, I have some files in directory.each file contain some data. my requirement is add the count of each line of file in head of each file. any advice !!!!!!!! (4 Replies)
Discussion started by: abhigrkist
4 Replies

5. UNIX for Advanced & Expert Users

gzip vs pipe gzip: produce different file size

Hi All, I have a random test file: test.txt, size: 146 $ ll test.txt $ 146 test.txt Take 1: $ cat test.txt | gzip > test.txt.gz $ ll test.txt.gz $ 124 test.txt.gz Take 2: $ gzip test.txt $ ll test.txt.gz $ 133 test.txt.gz As you can see, gzipping a file and piping into gzip... (1 Reply)
Discussion started by: hanfresco
1 Replies

6. UNIX for Dummies Questions & Answers

gzip of a file in the same folder

I want gzip of a file in the same folder where it is kept now $filename = '/var/dev/test.txt' /opt/home/>> gzip -c $filename > test.txt.gz however command creates it in the folder in /opt/home/ How to gzip a file in the same directory where it is now , no matter from where we execute and also... (2 Replies)
Discussion started by: lalitpct
2 Replies

7. Shell Programming and Scripting

Removing part of a file name and appending into a single file

I have two files like ABC_DEF_yyyyymmdd_hhmiss_XXX.txt and ABC_DEF_yyyyymmdd_hhmiss_YYY.txt. The date part is going to be changing everytime. How do i remove this date part of the file and create a single file like ABC_DEF_XXX.txt. (8 Replies)
Discussion started by: varlax
8 Replies

8. Shell Programming and Scripting

Check if file is locked otherwise gzip it

Dear community, I've a continuos tcpdump on redhat that close the dumped file every 100000 captured packets. To avoid disk full I would like to gzip the closed *.cap file. But how can I check if the file is currently opened by tcpdump and skip it from gzip? Thanks! EDIT: Just to post an... (9 Replies)
Discussion started by: Lord Spectre
9 Replies

9. Shell Programming and Scripting

File name manipulation when extracting from gzip

Hi, Below is the description of my problem. I am trying to loop through the below file names sitting in the file - FileNames.txt, and trying to decompress them FileNames.txt 20150408_MGAC_.txt.gz 20150408_MGCC_.txt.gz 20150408_MGSH__.txt.gz 20150408_MGSL__.txt.gz ... (6 Replies)
Discussion started by: Richmond_CS
6 Replies

10. Shell Programming and Scripting

Shell script not able to zip the file using gzip

Hi all, I am calling Temp.sh and it is has simple line $gpath=`which gzip` $gpath $FilePath/My_temp.log if I run this script, logging to server then its works fine. But when I send this script over the SSH it does not work at it. gzip is command is not execute. I am using gzip 1.6... (2 Replies)
Discussion started by: girijajoshi
2 Replies
SAVELOG(8)						      System Manager's Manual							SAVELOG(8)

savelog - save a log file SYNOPSIS
savelog [-m mode] [-u user] [-g group] [-t] [-p] [-c cycle] [-l] [-j] [-J] [-1 .. -9] [-C] [-d] [-l] [-r rolldir] [-n] [-q] [-D dateformat] file ... DESCRIPTION
The savelog command saves and optionally compresses old copies of files. Older versions of file are named: file.<number><compress_suffix> where <number> is the version number, 0 being the newest. Version numbers > 0 are compressed unless -l prevents it. Version number 0 is not compressed because a process might still have file opened for I/O. Only cycle versions of the file are kept. If the file does not exist and -t was given, it will be created. For files that do exist and have lengths greater than zero, the following actions are performed: 1) Version numbered files are cycled. Version file.2 is moved to version file.3, version file.1 is moved to version file.2, and so on. Finally version file.0 is moved to version file.1, and version file is deleted. Both compressed names and uncompressed names are cycled, regardless of -l. Missing version files are ignored. 2) The new file.1 is compressed unless the -l flag was given. It is changed subject to the -m, -u, and -g flags. 3) The main file is moved to file.0. 4) If the -m, -u, -g, -t, or -p flags are given, then an empty file is created subject to the given flags. With the -p flag, the file is created with the same owner, group, and permissions as before. 5) The new file.0 is changed subject to the -m, -u, and -g flags. OPTIONS
-m mode chmod the log files to mode, implies -t -u user chown log files to user, implies -t -g group chgrp log files to group, implies -t -c cycle Save cycle versions of the logfile (default: 7). The cycle count must be at least 2. -t touch new logfile into existence -l don't compress any log files (default: do compress) -p preserve owner, group, and permissions of logfile -j compress with bzip2 instead of gzip -J compress with xz instead of gzip For xz no strength option is set, and xz decides on the default based on the total amount of physical RAM. Note that xz can use a very large amount of memory for the higher compression levels. -1 .. -9 compression strength or memory usage (default: 9, except for xz) -C force cleanup of cycled logfiles -d use standard date for rolling -D dateformat override date format, in the syntax understood by the date(1) command -r use rolldir instead of . to roll files -n do not rotate empty files -q be quiet BUGS
If a process is still writing to file.0, and savelog moves it to file.1 and compresses it, data could be lost. SEE ALSO
logrotate(8) Debian 30 Dec 2017 SAVELOG(8)

Featured Tech Videos

All times are GMT -4. The time now is 07:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy