Skip to Content
Mastering Linux Shell Scripting - Second Edition
book

Mastering Linux Shell Scripting - Second Edition

by Mokhtar Ebrahim, Andrew Mallett
April 2018
Beginner
284 pages
7h 3m
English
Packt Publishing
Content preview from Mastering Linux Shell Scripting - Second Edition

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Linux Shell Scripting - Second Edition

Learning Linux Shell Scripting - Second Edition

Ganesh Sanjiv Naik
Linux Shell Scripting Cookbook - Third Edition

Linux Shell Scripting Cookbook - Third Edition

Clif Flynt, Sarath Lakshman, Shantanu Tushar

Publisher Resources

ISBN: 9781788990554Supplemental Content