Questions

  1. Assume that you have the following file:
Welcome to shell scripting.I love shell scripting.shell scripting is awesome.

Say you run the following command:

$ awk '/awesome$/{print $0}' myfile

How many lines will be printed in the output?

  1. How many lines will be printed if we use the following command against the previous file?
$ awk '/scripting\..*/{print $0}' myfile
  1. How many lines will be printed if we use the following command against the previous sample file?
$ awk '/^[Ww]?/{print $0}' myfile
  1. What is the output of the following command?
$ echo "welcome to shell scripting" | sed -n '/Linux|bash|shell/p'

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.