Forrest logo
tool overview
On this page you find all important commands for the CLI tool egrep. If the command you are looking for is missing please ask our AI.

egrep

The egrep command line tool is short for "extended grep", a powerful text pattern matching program available in Unix-like operating systems. It is an enhanced version of the grep tool with added functionalities.

Some key features of egrep include:

  1. Regular Expressions: egrep supports the use of regular expressions, allowing you to search for patterns in text based on specific rules and patterns. This makes it highly flexible for searching and filtering text.

  2. Extended Regular Expressions: egrep specifically supports extended regular expressions (ERE) as opposed to basic regular expressions (BRE) supported by grep. ERE provides additional pattern matching capabilities, including the use of metacharacters like +, ?, |, and parentheses for grouping.

  3. Pattern Matching: egrep allows you to search for patterns within files or input streams based on the provided regular expression. It can search for single or multiple patterns simultaneously, making it useful for complex searches.

  4. Color Highlighting: egrep can highlight the matched patterns in the output, making it easier to identify and locate the desired information.

  5. File Inclusion/Exclusion: egrep lets you specify the files to include or exclude from the search using either file names or regular expressions.

  6. Inverse Matching: By using the -v flag, egrep can perform inverse matching, showing lines that do not match the specified pattern.

Overall, egrep is a versatile tool for searching and filtering text using regular expressions. It is commonly used in shell scripting, log analysis, data extraction, and other text processing tasks.

List of commands for egrep:

  • egrep:tldr:13e22 egrep: Search for a pattern within a file.
    $ egrep "${search_pattern}" ${filename}
    try on your machine
    explain this command
  • egrep:tldr:1cf55 egrep: Print file name and line number for each match.
    $ egrep --with-filename --line-number "${search_pattern}" ${filename}
    try on your machine
    explain this command
  • egrep:tldr:9c456 egrep: Search for a pattern within multiple files.
    $ egrep "${search_pattern}" ${filename1} ${filename2} ${filename3}
    try on your machine
    explain this command
  • egrep:tldr:dd3c1 egrep: Search for lines that do not match a pattern.
    $ egrep --invert-match "${search_pattern}" ${filename}
    try on your machine
    explain this command
tool overview