Multiple choice technology

Command to invert the selection in grep

  1. grep -i

  2. grep -v

  3. grep -p

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The grep -v command inverts the match, showing lines that don't contain the pattern. grep -i makes the search case-insensitive, not inverted.

AI explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) grep -i - This option is incorrect because the -i flag is used to perform a case-insensitive search, not to invert the selection.

Option B) grep -v - This option is correct. The -v flag inverts the selection in grep, meaning it will show all lines that do not match the given pattern.

Option C) grep -p - This option is incorrect. The -p flag is not used in grep to invert the selection.

Option D) None of the above - This option is incorrect because option B, grep -v, is the correct command to invert the selection in grep.

Therefore, the correct answer is option B.