Forrest logo
back to the zegrep tool

zegrep:tldr:b40a1

zegrep: Search for lines that do not match a pattern.
$ zegrep --invert-match "${search_pattern}" ${filename}
try on your machine

The command zegrep is used to search for a pattern in one or multiple compressed or uncompressed files. It is similar to the grep command but it supports compressed files. Here is the explanation of the given command:

  • --invert-match: This flag is used to invert the matching behavior of zegrep. Instead of displaying lines that match the pattern, it displays the lines that do not match the pattern.

  • "${search_pattern}": This is the pattern you want to search for within the file(s). It can be enclosed in quotes or not, depending on the presence of special characters.

  • ${filename}: This is the name of the file(s) in which you want to search for the pattern. It can be a single file or multiple files separated by spaces.

Overall, the command searches for lines in the specified file(s) that do not match the given pattern and displays those lines in the output.

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 zegrep tool