1

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!

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.

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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