LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

zfgrep

Search gzip-compressed files for fixed strings

TLDR

Search for literal string in gzipped file
$ zfgrep "[string]" [file.gz]
copy
Case-insensitive search
$ zfgrep -i "[string]" [file.gz]
copy
Show line numbers
$ zfgrep -n "[string]" [file.gz]
copy
Count matching lines
$ zfgrep -c "[string]" [file.gz]
copy
List files containing matches
$ zfgrep -l "[string]" [*.gz]
copy

SYNOPSIS

zfgrep [grep-options] [-e] pattern [file...]

DESCRIPTION

zfgrep searches for fixed strings in gzip-compressed files without manual decompression. It's equivalent to zcat file.gz | fgrep pattern but more convenient.The "f" indicates fixed string matching (like grep -F). Patterns are interpreted literally, not as regular expressions. This is faster than regex matching and useful when searching for strings containing special characters.zfgrep automatically handles both compressed and uncompressed files, making it safe for mixed file sets.Multiple patterns can be specified, one per line, using -e or by newline-separating them.

PARAMETERS

-i

Case-insensitive matching
-n
Show line numbers
-l
List filenames with matches only
-c
Count matching lines
-v
Invert match (show non-matching lines)
-h
Suppress filename in output
-e pattern
Specify pattern
-x
Match whole lines only

INSTALL

sudo apt install gzip
copy
sudo dnf install gzip
copy
sudo pacman -S gzip
copy
sudo apk add gzip
copy
sudo zypper install gzip
copy
brew install gzip
copy
nix profile install nixpkgs#gzip
copy

CAVEATS

Only gzip compression is supported. Use bzfgrep for bzip2 files or pipe through appropriate decompressors for other formats.Fixed string matching means special characters like .,\*, [ are literal. Use zgrep or zegrep if regex is needed.Processing large compressed files requires CPU for decompression.

SEE ALSO

zgrep(1), zegrep(1), fgrep(1), zcat(1), gzip(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid