Command to invert the selection in grep
-
grep -i
-
grep -v
-
grep -p
-
None of the above
The grep -v command inverts the match, showing lines that don't contain the pattern. grep -i makes the search case-insensitive, not inverted.
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.