Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to create a new tar archive from the filtered output of the original. I thought something like this might work:

tar xvpf myarchive.tar --exclude=foo* | tar cvpf mynewarchive.tar

but that doesn't.

Any ideas?

Thanks!

share|improve this question

1 Answer 1

Almost there. That extracts to the filesystem. Adding -O or --to-stdout to the first tar and removing v (which would corrupt stdout) and p (doesn't make sense) should be sufficient.

share|improve this answer
    
Ah, getting closer. The second command complains still: tar: "no files or directories specified". How do I specify that it should take stdin? –  Frank Brenner Sep 27 '11 at 22:26
    
I have come to the conclusion it cannot be done. –  Mark Wagner Sep 27 '11 at 23:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.