Forrest logo
back to the zfgrep tool

zfgrep:tldr:c2ec8

zfgrep: Display all lines except those that contain the search string.
$ zfgrep --invert-match ${search_string} ${filename}
try on your machine

The zfgrep --invert-match ${search_string} ${filename} command is used to search for lines in the specified file that do not contain the provided search string.

Here's what each part of the command does:

  • zfgrep: This is the command itself, which is a variant of the fgrep command used for searching fixed strings. It is optimized for searching within compressed files.

  • --invert-match: This option tells zfgrep to invert the matching logic. Instead of displaying lines that contain the search string, it shows lines that do not contain it.

  • ${search_string}: This is the variable that should be replaced with the actual string you want to search for. It could be a word, phrase, or any specific text pattern.

  • ${filename}: This is the variable that should be replaced with the name of the file you want to search within. It could be the path to the file or just the filename if it exists in the current directory.

By executing this command, you will get a list of lines from the specified file that do not contain the provided search string, which can be helpful for filtering out specific content from a file.

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