Jo has received a text file which contains multiple instances of his name spelled correctly as well as multiple instances spelled as Joe. Which of the following commands would search a text file for any occurrences of either spelling and display them out to the terminal? (Choose three.)
A. grep "Joe?" document1.txt
B. grep -E "Joe?" document1.txt
C. grep "Joe*" document1.txt
D. grep -E "Joe*" document1.txt

Respuesta :

Answer:

B. grep -E "Joe?" document1.txt

C. grep "Joe*" document1.txt

D. grep -E "Joe*" document1.txt

Explanation:

Grep is an acronym that stands for Global Regular Expression Print.

Grep is a Linux / Unix command line tool used to search for a string of characters in a specified file. The text search pattern is called a regular expression. When it finds a match, it prints the line with the result. The grep command is handy when searching through massive log files.

Using the grep Command

The grep command consists of three parts in its most basic form. The first part starts with grep followed by the pattern that you are searching for. After the string comes the file name that the grep searches through.