Lpic 1 Linux Administrator · Free Practice Question Easy

Question 8

What is the purpose of the -v option when used with the grep command?
  • A It highlights the matching portions of the text in color.
  • B It displays the version information of the grep command.
  • C It inverts the match, displaying only the lines that do not match the pattern.
  • D It reverses the order of the output, showing the last matching line first.
  • E It prints all lines, marking the lines that match the pattern with a "+" symbol.
Reveal correct answer

Correct answer: C

A. The -v option in the grep command does not highlight matching portions of the text in color. It is used for inverting the match and displaying lines that do not match the specified pattern.

B. The -v option in the grep command does not display the version information of the grep command. It is used to invert the match and display lines that do not match the pattern.

C. The -v option in the grep command is correct because it inverts the match, displaying only the lines that do not match the specified pattern. This can be useful for filtering out unwanted lines from the output.

D. The -v option in the grep command does not reverse the order of the output to show the last matching line first. It is used to invert the match and display lines that do not match the pattern.

E. The -v option in the grep command does not print all lines and mark the lines that match the pattern with a "+" symbol. It is used to invert the match and display lines that do not match the specified pattern.

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need