LinuxCommandLibrary

zfgrep

Matches fixed strings in possibly compressed files.

TLDR

Search for an exact string in a file

$ zfgrep [search_string] [path/to/file]
copy


Count the number of lines that match the given string in a file
$ zfgrep --count [search_string] [path/to/file]
copy


Show the line number in the file along with the matching lines
$ zfgrep --line-number [search_string] [path/to/file]
copy


Display all lines except those that contain the search string
$ zfgrep --invert-match [search_string] [path/to/file]
copy


List only filenames whose content matches the search string at least once
$ zfgrep --files-with-matches [search_string] [path/to/file1 path/to/file2 ...]
copy

Help

Usage: /usr/bin/zgrep [OPTION]... [-e] PATTERN [FILE]... 
Look for instances of PATTERN in the input FILEs, using their 
uncompressed contents if they are compressed. 

OPTIONs are the same as for 'grep', except that the following 'grep' 
options are not supported: --dereference-recursive (-R), --directories (-d), 
--exclude, --exclude-from, --exclude-dir, --include, --null (-Z), 
--null-data (-z), and --recursive (-r). 

Report bugs to 

Copied to clipboard