Is it possible to use the find
command so that it searches the files within a tar.gz archive also using wildcards?
like
find archive.tar.gz --name *foo*
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityHow about just:
$ tar tf archive.tar.gz | grep foo
tar tf graphics.tar.gz | find . --name *space*
but it says unkown predicate --name
find
arguments only take one dash, but because it's a list of files on stdin, you want to use grep
instead, like hesse's example code. Try tar tf graphics.tar.gz | grep 'space'
grep *foo*
isn't a valid regular expression. greg
doesn't understand globs, it understands regular expressions. Try grep foo
instead.
Mount the archive as a directory. You can do it with the AVFS filesystem, which allows you to access any archive as a directory whose name has a trailing #
.
mountavfs
cd ~/.avfs$PWD
find archive.tar.gz\# -name '*foo*'
I think it works with no pipe and grep.
like this:
tar tvf archive.tar.gz "foo"
as this way, globs will also work.
tar tvf archive.tar.gz "*.foo"