Multiple choice technology architecture

Output of the AWK Command? Consider the below contents of the file named testfile. smawley, andy smiley, allen smith, alan smithern, harry smithhern, anne smitters, alexis EOF awk '/smith+ern/' testfile

  1. print to standard output of all records that contained an occurrence of the string smi

  2. prints to standard output any record that contained a string with the characters smit, followed by one or more h characters, and then ending with the characters ern.

  3. prints to standard output of all records that contain the characters smit, followed by zero or one instance of the h character.

  4. prints to standard output of all records that contained the string smi or smit.

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

The awk pattern '/smith+ern/' uses the + quantifier meaning 'one or more' of the preceding character 'h'. This matches smithern (h+ern) and smithhern (hh+ern). The pattern requires 'smith' followed by one or more 'h' characters, then 'ern'. Option A incorrectly describes it as matching 'smi' only, while Option C confuses + with ? (zero or one).