4

I am using the zutils version of zgrep v0.9 (not the gzip wrapper script) and to recursively grep zip files starting from the current folder I simply use:

zgrep -r "MY_STRING" .

This works fine. However, it does not search zip files within zip files.

How do I grep recursively across a directory and recursively search zip files within zip files?

Dan
  • 396

2 Answers2

2

The zgrep utility from zutils doesn't support zip files at all. It treats them as ordinary files, so it won't find anything except in members that are stored in raw format (which mostly happens for very small files).

The zipgrep utility distributed with unzip doesn't search zip files recursively.

For how to solve your actual problem, see How do I recursively grep through compressed archives?

1

The only tool that I know of that can recursively search zip files and other compressed files and archives embedded in zip files is ugrep with options -z and --zmax=2 for two dearchiving/decompression levels deep (e.g. zip in a zip), where --zmax can go up to 99.