Linux-Commands

Question 1
What does the following command do?
grep -vn “abc” x
A
It will print all of the lines in the file x that match the search string “abc”.
B
It will print all of the lines in file x that do not match the search string “abc”.
C
It will print the total number of lines in the file x that match the string “abc”.
D
It will print the specific line numbers of the file x in which there is a match for string “abc”.
Question 1 Explanation: 
The grep filter searches a file for a particular pattern of characters, and displays all lines that contain that pattern. The pattern that is searched in the file is referred to as the regular expression (grep stands for globally search for regular expression and print out).
Syntax: grep [options] pattern [files]
Step-1: grep -vn → This prints out all the lines that do not matches the pattern.
Step-2: grep -vn “abc” → “abc” is pattern
Step-3: grep -vn “abc” x → x is a file name
There is 1 question to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access