I have a big zip file and I want to know what it's contain. I know I can run:
zipinfo file.zip
but the output is too verbose and there are a lot of files in the sub-directories.
I want to see a list of the files in the top level.
Example
If the normal output is:
-sh-3.2$ zipinfo file.zip
Archive: file.zip 999999999 bytes 99999 files
-rw-r--r-- 2.3 unx 3894 tx defN 3-Jul-11 13:11 file1
drwxr-xr-x 2.3 unx 0 bx stor 23-Feb-12 21:00 dir1/
-rw-r--r-- 2.3 unx 269 tx defN 23-Oct-11 14:34 dir1/file2
drwxr-xr-x 2.3 unx 0 bx stor 25-Sep-11 03:53 dir1/subdir1/
...
drwxr-xr-x 2.3 unx 0 bx stor 23-Feb-12 21:00 dir2/
...
I want a command that will output:
-sh-3.2$ <answer>
Archive: file.zip 999999999 bytes 99999 files
-rw-r--r-- 2.3 unx 3894 tx defN 3-Jul-11 13:11 file1
drwxr-xr-x 2.3 unx 0 bx stor 23-Feb-12 21:00 dir1/
drwxr-xr-x 2.3 unx 0 bx stor 23-Feb-12 21:00 dir2/
drwxr-xr-x 2.3 unx 0 bx stor 23-Feb-12 21:00 dir3/
...
You can filter the output with grep. Here I'm telling grep to hide all rows that contain a slash '/' and anything after the slash:
Expanding and building on top of @dvb's answer, you can set the deepness level with extended regular expressions: