Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


share|improve this question

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


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.