LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

xzgrep

Search xz compressed files with grep

TLDR

Search for a pattern in an xz-compressed file
$ xzgrep "[pattern]" [file.xz]
copy
Search case-insensitively
$ xzgrep -i "[pattern]" [file.xz]
copy
Count matching lines
$ xzgrep -c "[pattern]" [file.xz]
copy
Show line numbers with matches
$ xzgrep -n "[pattern]" [file.xz]
copy
List files containing a match
$ xzgrep -l "[pattern]" [*.xz]
copy
Search using extended regular expressions
$ xzgrep -E "[regex_pattern]" [file.xz]
copy

SYNOPSIS

xzgrep [options] pattern [files...]

DESCRIPTION

xzgrep searches xz, lzma, and lzip compressed files for lines matching a pattern. It decompresses the data on the fly and passes it to grep, without creating temporary files on disk. All standard grep options are supported. Also available as xzegrep and xzfgrep variants.

PARAMETERS

-i

Case insensitive search.
-n
Show line numbers.
-c
Count matching lines.
-l
List only filenames containing matches.
-v
Invert match (show non-matching lines).
-E
Use extended regular expressions (like egrep).
-F
Use fixed strings instead of regular expressions (like fgrep).
-h
Suppress filename prefix on output.
-H
Always print filename prefix.

SEE ALSO

xz(1), grep(1), zgrep(1), lzgrep(1)

Copied to clipboard
Kai