nerdexam
Linux_Foundation

LFCS · Question #797

What is the effect of the egrep command when the -v option is used?

The correct answer is B. It only outputs non-matching lines. When the -v option is used with the egrep command, it performs an inverse match, showing only lines that do not contain the specified pattern.

Submitted by luis.pe· Apr 18, 2026Essential Commands

Question

What is the effect of the egrep command when the -v option is used?

Options

  • AIt enables color to highlight matching parts.
  • BIt only outputs non-matching lines.
  • CIt shows the command's version information.
  • DIt changes the output order showing the last matching line first.

How the community answered

(45 responses)
  • B
    93% (42)
  • C
    4% (2)
  • D
    2% (1)

Why each option

When the `-v` option is used with the `egrep` command, it performs an inverse match, showing only lines that do not contain the specified pattern.

AIt enables color to highlight matching parts.

Enabling color highlighting is typically done with options like `--color` or through shell configuration, not `-v`.

BIt only outputs non-matching lines.Correct

The `-v` (or `--invert-match`) option with `egrep` (and `grep`) modifies its behavior to output only those lines from the input that do *not* match the provided regular expression pattern.

CIt shows the command's version information.

Displaying version information for a command is usually achieved with `--version` or `-V`, not `-v`.

DIt changes the output order showing the last matching line first.

The `-v` option filters lines based on whether they match a pattern; it does not alter the order of the output.

Concept tested: egrep -v option (invert match)

Source: https://www.gnu.org/software/grep/manual/grep.html

Topics

#grep#egrep#command-line options#text processing

Community Discussion

No community discussion yet for this question.

Full LFCS Practice