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 nmap command?

583


Which command is used to copy files?

556


Write a command to display a file’s contents in various formats?

625


How to use grep command to list find the records of a file containing 10 different strings?

645


Explain ‘system calls’ with respect to unix commands?

602






How does the system know where one command ends and another begins?

1578


What is ctrl d?

594


Give the command for finding the current date.

583


What is command statement?

543


What command will change your prompt to myprompt?

704


What does sed command do in unix?

566


What is awk used for?

622


What is ‘ps’ command for?

616


Who command in unix?

576


Can you enlist some commonly used network commands?

602