Multiple choice

Which symbol will be used with grep command to match the pattern pat at the beginning of a line?

  1. ^pat

  2. $pat
  3. pat$
  4. pat^

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In regular expressions used with grep, the caret symbol (^) anchors the match to the beginning of a line. Conversely, the dollar sign ($) matches the end of a line.