COP 3344-01 Introduction to Unix: Lecture 8

Learning objectives

After this class, you should be able to:

  1. Given a regular expression, identify the strings that it will match.
  2. Given specifications of the strings that a regular expression should and should not match, construct a suitable regular expression.
  3. Give grep or egrep commands that will output all lines containing strings that match a specified criterion, from a set of files.
  4. Explain the purpose of the following special symbols used in defining regular expressions: (i) *, (ii) (), (iii) [], (iv) +, (v) ., (vi) ^, (vii) $, (viii) -, (ix) |, and (x) ?.

Reading assignment

  1. JEA: Appendix D, grep tutorial.
  2. Lecture slides: Lecture 8.

Exercises and review questions


Last modified: 5 Nov 2007