How to move files to existing .tgz file?

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to move files to existing .tgz file?
# 1  
Old 06-28-2011
How to move files to existing .tgz file?


I have already created the tar files. which consist of some log files and Audit.csv

plz see the below code for that
tar -Pczf ARCH/${arc_date}.tgz $LOG/*.log $REYE/CEP/FiAdapter/Audit.${arc_date}.csv 

now i want to move(add) some sal.csv drf.log files to existing ${arc_date}.tgz .
can anybody help me how is it possible?

Thanks in advance...


Last edited by vbe; 06-28-2011 at 04:57 AM.. Reason: please use code tags
# 2  
Old 06-28-2011
use -r option

---------- Post updated at 01:37 PM ---------- Previous update was at 01:28 PM ----------

as it is compressed, you can use the below commands
gzip -dc ARCH/${arc_date}.tgz | tar -r $LOG/*.log $REYE/CEP/FiAdapter/Audit.${arc_date}.csv | gzip > archive_new.tar.gz

gunzip your-tar-file
tar rf your-tar-file file1 file2
gzip your-tar-file

# 3  
Old 06-28-2011

in below code ARCH folder contains alredy *.log and

tar -Pczf ARCH/${arc_date}.tgz $LOG/*.log $REYE/CEP/FiAdapter/Audit.${arc_date}.csv


i want to add new files in to existing tar file eg: sal.csv drf.log files

how to do that??????????

the code given by u is same like my code. i need the command for adding new files in to existing tar file

Last edited by Franklin52; 06-28-2011 at 07:39 AM.. Reason: Please use code tags for code and data samples, thank you
# 4  
Old 06-28-2011
You use the -r option to append files to an archive.

Last edited by Neo; 06-28-2011 at 11:12 AM.. Reason: Removed: "Please read the man page" without link or reference
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extracting specific files from multiple .tgz files

Hey, I have number of .tgz files and want to extract the file with the ending *results.txt from each one. I have tried for file in *.tgz; do tar --wildcards -zxf $file *results.txt; doneas well as list=$(ls *.tgz) for i in $list; do tar --wildcards -zxvf $i *.results.txt; done... (1 Reply)
Discussion started by: jfern
1 Replies

2. Shell Programming and Scripting

Append files to a existing tar file.

Hi all, I want to check whether tar file exists in the directory or not. If tar file exists in the directory then I want to append the files to it. I am using the below command to tar files if the file does not exist. tar zcvf <tar file name> <Files to append> However, if want to... (4 Replies)
Discussion started by: Nagaraja Akkiva
4 Replies

3. AIX

Unable to gunzip .tgz file in AIX6.1

Hi guys, This is my 1st post here. I tried to Google around but failed to get my solution. So I hope you guys could help me. (I have just a basic unix background for 2years so I'm sorry if im asking stupid questions) OS - Aix 6.1, 64 bits. Server - currently I only have telnet access to a... (12 Replies)
Discussion started by: pilotHans
12 Replies

4. Shell Programming and Scripting

Need help in writing a script to create a new text file with specific data from existing two files

Hi, I have two text files. Need to create a third text file extracting specific data from first two existing files.. Text File 1: Format contains: SQL*Loader: Release - Production on Wed Aug 4 21:06:34 2010 some text on...and somwhere text like: Record 1:... (1 Reply)
Discussion started by: shashi143ibm
1 Replies

5. UNIX for Dummies Questions & Answers

how to add files to an existing tar file - HP-UNIX

Hello, What is the command to add files to an existing tar file. Thanks, (5 Replies)
Discussion started by: Nomaad
5 Replies

6. UNIX for Dummies Questions & Answers

file.tgz.1of2 & file.tgz.2of2

Hi all, Need help. Anybody seen this kind of file before? file.tgz.1of2 file.tgz.2of2 how to extract this tgz file? Any help? Tq (5 Replies)
Discussion started by: zeedwolf
5 Replies

7. UNIX for Dummies Questions & Answers

Extract .tgz files that only contain a pattern

Let's say I've got File.tgz that contains:- Apple.txt Banana.txt Carrot.txt AppleBanana.txt Now, I would like to only extract files that contain the patter "Apple". I've tried this tar -xvf File.tgz 'tar -tf File.tgz | grep 'Apple'' but it does not work. Please help. Thanks. (12 Replies)
Discussion started by: percivalwcy
12 Replies

8. UNIX for Dummies Questions & Answers

Create individual tgz files from a set of files

Hello I have a ton of files in a directory of the format app.log.2008-04-04 I'd like to run a command that would archive each of these files as app.log.2008-04-04.tgz I tried a few combinations of find with xargs etc but no luck. Thanks Amit (4 Replies)
Discussion started by: amitg
4 Replies

9. Windows & DOS: Issues & Discussions

*.tgz file on WinXP

Could anyone of y'all gurus tell me of how to open *.tgz files in WinXP....which program should i use to open it...i have tried going online to open it ut all in vain...please help Gerry... (5 Replies)
Discussion started by: gerald_agoi
5 Replies

10. UNIX for Dummies Questions & Answers

unzip .tgz files

hi all How to unzip .tgz files waiting for suggestions Praful (5 Replies)
Discussion started by: Prafulla
5 Replies
Login or Register to Ask a Question