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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the significance of the 'tee' command?

594


Which unix command to make a new directory?

587


What do know about tee command?

600


What are reported commands?

562


Why is grep called grep?

773






What are grep patterns?

573


Which command is used to delete all files in the current directory and all its sub-directories?

660


What command is used to check the current users?

592


How do I search a whole word in vim?

687


What is the command to find hidden files in the current directory?

577


Which command is used to create a directory?

567


How do I use nslookup?

569


Who command in unix operating system?

658


How do I open a port?

587


Name the unix command to find how many days the server has been up.

598