Using grep with regular expressions
This module covers regular expression syntax, which is used for performing wildcard searches of the contents of files.
If you have used a word processing application on another operating system, you are probably familiar with the concept of regular expressions.
Many UNIX programs that manipulate or search for text can take advantage of regular expressions.
This module will cover regular expressions as used by
grep, a program that is commonly used to search the contents of files.
By the end of this module, you will be able to: In the next lesson, you will learn about regular expressions.
Describe what regular expressions are
Identify how the use of quotes affects the interpretation of regular expressions.
Create regular expressions using various metacharacters.
Use the backslash (
\) to disable the special meaning of a character
You must understand what the following predefined character classes do:
. Any character (may or may not match line terminators) (Depending on ?m)
\d A digit: [0-9]
\D A non-digit: [^0-9]
\s A whitespace character: [ \t\n\x0B\f\r]
\S A non-whitespace character: [^\s]
\w A word character: [a-zA-Z_0-9]
\W A non-word character: [^\w]
\b A word boundary
\B A non-word boundary