I have .tgz archive i'm trying to locate a directory within it to extra how do i search within a .tgz i tried the following below but no luck.
tar -tzf archive-9.tgz | grep '161519' | xargs tar -Oxzf archive-9.tgz | grep -B 3
Would it not be easier all in one go?
I think the reason it appears not to work with xargs is that your grep will find the directory first (pass it on and tar with extract it all) then grep will continue with the contents (pass it on and tar will fail to find those files since it has already extracted them). But this is only a guess.