Unix/Linux Go Back    


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

Hpux find tar gzip

HP-UX


Tags
find tar gzip

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 08-05-2016
royinfo.alain royinfo.alain is offline
Registered User
 
Join Date: Aug 2016
Last Activity: 8 August 2016, 2:50 PM EDT
Posts: 8
Thanks: 11
Thanked 0 Times in 0 Posts
Hpux find tar gzip

Hello,

I will like to execute a find, tar & gzip in one command.


Code:
 find * -type f -mtime -$nb_days -print | xargs tar -cvf  $MAITUT/BCK_DATA.tar 
gzip $MAITUT/BCK_DATA.tar.gz


The fact that the TAR is very big, at the end I need to generate only a compress file.

Please note that the option z or -T on the tar are not available.

thanks


Moderator's Comments:
Hpux  find tar gzip Please use CODE tags as required by forum rules!

Last edited by RudiC; 08-05-2016 at 08:43 AM.. Reason: Added CODE tags.
Sponsored Links
    #2  
Old Unix and Linux 08-05-2016
RudiC RudiC is online now Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 28 March 2017, 1:40 PM EDT
Location: Aachen, Germany
Posts: 10,547
Thanks: 256
Thanked 3,232 Times in 2,979 Posts
What keeps you from just piping tar's stdout into gzip?
The Following User Says Thank You to RudiC For This Useful Post:
royinfo.alain (08-05-2016)
Sponsored Links
    #3  
Old Unix and Linux 08-05-2016
royinfo.alain royinfo.alain is offline
Registered User
 
Join Date: Aug 2016
Last Activity: 8 August 2016, 2:50 PM EDT
Posts: 8
Thanks: 11
Thanked 0 Times in 0 Posts
thank you for your answer.

I'm a HP MPE guy's.. I'm just starting with Unix. I'm not really understand when you said pipe in stdout.

Is it possible to have an example ?

Merci
    #4  
Old Unix and Linux 08-05-2016
RudiC RudiC is online now Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 28 March 2017, 1:40 PM EDT
Location: Aachen, Germany
Posts: 10,547
Thanks: 256
Thanked 3,232 Times in 2,979 Posts
Je vous en prie.

You already used a pipe in your sample. Try (untested, may need further polishing)


Code:
find * -type f -mtime -$nb_days -print | xargs tar -cv | gzip > $MAITUT/BCK_DATA.tar.gz

The Following User Says Thank You to RudiC For This Useful Post:
royinfo.alain (08-05-2016)
Sponsored Links
    #5  
Old Unix and Linux 08-05-2016
royinfo.alain royinfo.alain is offline
Registered User
 
Join Date: Aug 2016
Last Activity: 8 August 2016, 2:50 PM EDT
Posts: 8
Thanks: 11
Thanked 0 Times in 0 Posts
Thanks,

I tries and gave me the error :


Code:
tar: cannot open /dev/rmt/0m


Last edited by RudiC; 08-05-2016 at 12:32 PM..
Sponsored Links
    #6  
Old Unix and Linux 08-05-2016
RudiC RudiC is online now Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 28 March 2017, 1:40 PM EDT
Location: Aachen, Germany
Posts: 10,547
Thanks: 256
Thanked 3,232 Times in 2,979 Posts
Hmmm - would adding -f- (i.e. write to stdout) help?
Sponsored Links
    #7  
Old Unix and Linux 08-05-2016
royinfo.alain royinfo.alain is offline
Registered User
 
Join Date: Aug 2016
Last Activity: 8 August 2016, 2:50 PM EDT
Posts: 8
Thanks: 11
Thanked 0 Times in 0 Posts
I tried with the f and have no errors..

the command that I used :
Code:
find * -type f -mtime -365 -print | xargs tar -cvf | gzip > $MAITUT/BCK_DATA.tar.gz

Maybe I've not understand where to put the -f ?

It showed me on the screen all files selected by the Find command.

At the end when I did a ll of my gzip file it seems that it has nothing in :


Code:
-rw-rw-r-- 1 maitdev mait 20 Aug 5 10:19 /umaitdevapp/home/maitdev/tmp/BCK_DATA.tar.gz

and when I used : gzip -dc < $MAITUT/BCK_DATA.tar.gz | tar -xvf -
I've got the error : Tar: blocksize = 0; broken pipe?

Seems that the result does not go into the gzip file.

thanks


Moderator's Comments:
Hpux  find tar gzip Please use CODE tags as required by forum rules!

Last edited by rbatte1; 08-08-2016 at 05:13 AM.. Reason: Added CODE tags.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need help ASAP - FIND - TAR - GZIP royinfo.alain UNIX for Beginners Questions & Answers 2 08-04-2016 04:46 PM
Failed to use find-tar-gzip together Chetanz UNIX for Dummies Questions & Answers 7 02-01-2013 04:23 PM
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
From HPUX tar to Linux tar iarot Filesystems, Disks and Memory 4 02-14-2002 03:10 AM



All times are GMT -4. The time now is 01:56 PM.