LinuxCommandLibrary

lzfgrep

Search compressed files for fixed strings

TLDR

Search for a fixed string in a compressed file
$ lzfgrep [string] [file.lz]
copy
Case-insensitive search
$ lzfgrep -i [string] [file.lz]
copy
Show line numbers with matches
$ lzfgrep -n [string] [file.lz]
copy
Count matching lines
$ lzfgrep -c [string] [file.lz]
copy
Search across multiple compressed files
$ lzfgrep [string] [file1.lz] [file2.lz]
copy
List files containing matches
$ lzfgrep -l [string] [*.lz]
copy

SYNOPSIS

lzfgrep [grepoptions] [**-e**] pattern [file_...]

DESCRIPTION

lzfgrep searches for fixed strings in files that may be compressed with xz, lzma, gzip, or bzip2. It is equivalent to lzgrep -F and is faster than regex-based search for literal string patterns. Files are automatically decompressed on the fly before searching.
lzfgrep is provided as part of xz-utils for backward compatibility with LZMA Utils. If no file is specified, standard input is decompressed if necessary and fed to grep.

PARAMETERS

All options are passed directly to grep(1). Common options include:
-i

Case-insensitive matching.
-n
Show line numbers.
-c
Print count of matching lines only.
-l
Print names of files with matches.
-v
Invert match (show non-matching lines).
-w
Match whole words only.
-e pattern
Specify the pattern explicitly.

CAVEATS

When reading from standard input, gzip and bzip2 compressed files are not supported. All options are passed directly to grep.

SEE ALSO

lzgrep(1), fgrep(1), lzegrep(1), xzgrep(1), zgrep(1), grep(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard