LinuxCommandLibrary

zipgrep

TLDR

Search in ZIP

$ zipgrep [pattern] [archive.zip]
copy
Search specific file
$ zipgrep [pattern] [archive.zip] [file.txt]
copy
Case insensitive
$ zipgrep -i [pattern] [archive.zip]
copy
Show line numbers
$ zipgrep -n [pattern] [archive.zip]
copy
Count matches
$ zipgrep -c [pattern] [archive.zip]
copy
List matching files
$ zipgrep -l [pattern] [archive.zip]
copy

SYNOPSIS

zipgrep [-i] [-n] [-c] [-l] pattern zipfile [members]

DESCRIPTION

zipgrep searches inside ZIP archives. It greps without extracting.
Pattern matching uses egrep. Regular expressions supported.
File specification limits search. Only named members searched.
Output shows file and match. Like grep on extracted contents.
Useful for large archives. No extraction needed.

PARAMETERS

-i

Case insensitive.
-n
Show line numbers.
-c
Count matches.
-l
List files only.
-h
No filename prefix.
-v
Invert match.
pattern
Search pattern.
members
Specific files.

CAVEATS

Shell wrapper around unzip/egrep. May be slow on large archives. Part of Info-ZIP.

HISTORY

zipgrep is part of Info-ZIP utilities. It provides grep functionality for ZIP contents.

SEE ALSO

unzip(1), grep(1), zgrep(1)

Copied to clipboard