The command
grep first second third /usr/you/myfile

a) prints lines containing the words first,
second or third from the file /usr/you/myfile
b) searches for lines containing the pattern
first in the files
second, third, and /usr/you/myfile and prints them
c) searches the files /usr/you/myfiel and
third for lines containing
the words first or second and prints them
d) replaces the word first with the word
second in the files third and /usr/you/myfile
e) None of the above

Answers were Sorted based on User's Feedback



The command grep first second third /usr/you/myfile a) prin..

Answer / apurba

Answer is B (searches for lines containing the pattern
first in the files second, third, and /usr/you/myfile and
prints them)

Is This Answer Correct ?    13 Yes 1 No

The command grep first second third /usr/you/myfile a) prin..

Answer / brijmohan

None of the option will work.

Because "grep first second third" this command will search
for the same pattern and but it should grep "first second
third" instead of grep first second third.

Is This Answer Correct ?    1 Yes 0 No

The command grep first second third /usr/you/myfile a) prin..

Answer / thajudeen

answer is E none of the above as it will search the pattern
as a single pattern "first second third"

Is This Answer Correct ?    2 Yes 2 No

The command grep first second third /usr/you/myfile a) prin..

Answer / sathe santosh

The above command will not work.
grep searches the 1st argument in 2nd argument(filename).
The filename has multiple patterns.

example:

cat 1.lst
hi
hello
bye

see the below message.

grep hi hello 1.lst
grep: can't open hello
1.lst:hi

same can be done using below command.

grep -e hi -e hello 1.lst

hi
hello

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More Unix Commands Interview Questions

Explain the terms ‘system calls’ and ‘library functions’ with respect to unix commands?

0 Answers  


How will you know who are the users logged in to the system before 15 minutes?

4 Answers   Amazon,


What do know about tee command?

0 Answers  


How to know a process is a zombie or orphan process?

3 Answers   Perot Systems,


What command would users use to see what file one page at a time in UNIX?

7 Answers   IBM,






How do you remove a crontab file?

6 Answers  


what is the command to find out the difference between files and folders?

6 Answers  


hi i have directories within the directory. Now i want to copy the directory along with all directories included in it to one location by using copy command? what is the command

2 Answers   ACS, Span Systems,


what is the command to find out which shell you are running?

14 Answers  


what are wild cards?

2 Answers  


What is mtime in find command?

1 Answers  


What is the command to compare two files in unix?

0 Answers  


Categories