Chapter 11

  1. 0 lines

Because there is a period after the word awesome, if you want to print that line, you can use the following command:

$ awk '/awesome\.$/{print $0}' myfile
  1. 2 lines

Since we search for the line that contains the word scripting. With a period after it followed by any text, this pattern only exists in two lines because the third line doesn't contain a period after the word.

  1. 3 lines

As we used the question mark that means the character class is not a must for the pattern to match.

  1. Nothing

As we used the pipe symbol, which is an ERE character, and as we used sed, we must use the -r option for sed to turn the extended engine on.

Get Mastering Linux Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.