|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Failed to use find-tar-gzip together
Hello I am trying to select multiple files older than 14 days and create a single compressed file out of it. (AIX Release 3 Version 5) I am trying to achieve it by following Code:
tar -cvf db01_log.tar `find . -name "db01*.log" -mtime +14" -print`| gzip > db01_log.tar however it just created a tar file and not tar.gz file could you please suggest on this? Thanks and Regards Chetanz Last edited by Scott; 02-01-2013 at 11:29 AM.. Reason: Not an AIX problem. Thread moved. |
| Sponsored Links | ||
|
|
#2
|
|||
|
|||
|
Write tar to stdout = - Code:
tar -cvf - `find . -name "db01*.log" -mtime +14" -print`| gzip > db01_log.tar |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
DGPickett is correct: either "tar" writes to a file (then the pipe is empty) or to <stdout>, but not both. There are some other things with your code you might want to change:
First, obviously, you shouldn't use backticks any more. Use "$(...)" instead. Second: "gzip" is - because of the way it works - a single-threaded program. If the amount of data you compress is huge it might take a very long time. Even if your system has several processors you will always use only one. If you want to overcome this you will have to distribute the files to back up over as many "tar"s as there are processors (sort them by size and use a round-robin scheme to balance the sizes) and then gzip each tar. This way you put all system processors to use. I hope this helps. bakunin |
|
#4
|
|||
|
|||
|
Hello DGPickett and Bakunin Thanks for your quick response I used the following, word to word and space to space But it created only the tar file and no gz file at all ![]() Code:
tar -cvf - `find . -name "db01_rman*04*Jan*.log" -mtime +14 -print`| gzip > db01_rman04Jan.log.tar Please suggest Thanks and Regards Chetanz |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
if you can live without tar use: Code:
find ... criteria ... | backup -if - | bzip2 >myfile.bff.bz2 or gzip if you prefer that. bzip2 was my habit speaking. |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Actually this should have done what you (and we) expected it to do, but when you insist in naming a gzipped tar-file "*.tar" the OS will not put any obstacles before you. This means: replace "> something.tar" with "something.tar.gz" and - voilá! You will find out that the output you named ".tar" is no tar file at all when you try to untar it. It probably will complain about some "checksum error", which is, because it simply is no tar-file. But if you try to unpack it by: Code:
mv your.tar your.tar.gz gzip -cd your.tar.gz | tar -xf - You will notice that this works. (gzip is just a bit picky about file extensions) I hope this helps. bakunin |
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
|
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| find + tar + gzip + uunecode/email --> in one command? | kchinnam | Shell Programming and Scripting | 3 | 03-02-2012 02:25 PM |
| tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file | ahSher | UNIX for Dummies Questions & Answers | 2 | 04-02-2009 04:43 AM |
| tar and gzip | tungaw2004 | UNIX for Dummies Questions & Answers | 3 | 06-22-2007 03:21 AM |
| tar/gzip/gz...which one to use? | abhijeetkul | UNIX for Advanced & Expert Users | 5 | 03-24-2006 02:00 AM |
| TAR and GZIP help | VandeMatram | UNIX for Dummies Questions & Answers | 3 | 03-17-2006 06:35 AM |
|
|