Ask Question

Which of the following commands uses correct syntax for matching the patterns bunk or bank at the end of a line of text?

a. grep 'b[au]nk$' myLine

b. grep "b[au]nk$" myLine

c. grep b[au]nk$ myLine

d. grep 'b[au]nk$" myLine

+5
Answers (1)
  1. 12 September, 00:51
    0
    a. grep 'b[au]nk$' myLine

    Explanation:

    grep is a command used for searching a specified pattern in a given text.

    Our goal is to match the character sequence - bank or bunk at the end of line in a given line referenced by myLine.

    The regular expression for the specified match criterion is:

    b[au]nk$

    The second character can be either a or u.

    $ indicates match at end of line.

    So the overall grep command is:

    grep 'b[au]nk$' myLine
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Which of the following commands uses correct syntax for matching the patterns bunk or bank at the end of a line of text? a. grep 'b[au]nk$' ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers