Forrest logo
back to the xzgrep tool

xzgrep:tldr:1d177

xzgrep: Search for lines matching a pattern, printing only the matched text.
$ xzgrep --only-matching "${search_pattern}" ${filename}
try on your machine

The xzgrep command is used to search for a specific pattern in a compressed file.

Here is a breakdown of the command:

  • xzgrep: This is the command itself, which is used to search for patterns within compressed files.
  • --only-matching: This option is used to display only the portion of the line where the pattern is found, instead of the entire line.
  • "${search_pattern}": This is the pattern you are searching for. It can be a string or a regular expression enclosed in double quotes.
  • ${filename}: This is the name of the compressed file you want to search within.

Overall, the command is searching for the specified ${search_pattern} within the contents of the ${filename} compressed file, and it will only display the matching portions of the lines where the pattern is found.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the xzgrep tool