Forrest logo
back to the egrep tool

egrep:tldr:dd3c1

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

The command egrep --invert-match "${search_pattern}" ${filename} is used to search for lines in a file that do not match a particular pattern.

Here is a breakdown of the command:

  • egrep: It stands for "extended grep" or "grep with regular expressions". It is a command-line utility for searching files using regular expressions.
  • --invert-match: It is an option in egrep that causes the command to print lines that do not match the specified pattern.
  • "${search_pattern}": This is a placeholder for the actual pattern you want to search for in the file. It should be enclosed in double quotes.
  • ${filename}: This is a placeholder for the name of the file you want to search within. It should be specified without quotes.

So, when you run the command, it will search the specified file for lines that do not match the given pattern and print them on the console.

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