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

When i run a programm of orphan process. Instead of getting child's parent (ppid)=1 ..i get 1400 and it varies as per system. How can i findthe right soluion??? My pgm: #include<stdlib.h> # include <stdio.h> int main() { int pid; pid=fork(); if(pid < 0) {exit(-1);} else if(pid==0) { printf("Child Process is Sleeping ..."); sleep(10); printf("Orphan Child's Parent ID : %u ",getppid()); } else { printf("Parent Process Completed ... %u ",getpid()); exit(0); } return 0; } Output:

0 Answers  


What is awk used for?

0 Answers  


Describe the usage and functionality of the command rm –r * in unix?

0 Answers  


Give the command to display space usage on the UNIX file system.

16 Answers  


What is the command to check ports active in UNIX?

4 Answers   Accenture, IBM,






if we create a file, in that 10 rows(means 1,2,....9,10 like). i want 7 row exactly, which command use in unix? plz send this question.

28 Answers   TCS,


Write a command that will output the sorted contents of a file named in.txt and place the output in another file named out.txt, while at the same time excluding duplicate entries.

1 Answers  


What is the use of the tee command?

0 Answers  


What is command statement?

0 Answers  


What is $0 bash?

0 Answers  


Using unix command how to display no of records in oracle?

0 Answers  


distinguish between user mode and kernel mode?

4 Answers   Infosys,


Categories