1.

Which one of the following command will be used for searching “director” in emp.lst?(a) grep“director”(b) grep -v “director”emp.lst(c) grep-director emp.lst(d) grep“director” emp.lstI got this question during an internship interview.My question is taken from grep command topic in chapter Filters using Regular Expressions of Unix

Answer»

Correct choice is (d) grep“director” emp.lst

To explain: Because grep command is also a filter, it can SEARCH it’s standard input for the PATTERN. For example, the command grep“director” emp.lst will search the FILE emp.lst for the pattern “director” and will display the LINES CONTAINING this pattern.



Discussion

No Comment Found

Related InterviewSolutions