Linux Shell Scripting Tutorial (LSST) v1.05r3
Chapter 6: Learning expressions with ex


In the chpater 5, "Quick Tour of essential utilities", you have seen basic utilities. If you use them with other tools, these utilities are very useful for data processing or for other works. In rest part of tutorial we will learn more about patterns, filters, expressions, and off course sed and awk in depth.

Learning expressions with ex

What does "cat" mean to you ?

One its the word cat, (second cat is an animal! I know 'tom' cat), If same question is asked to computer (not computer but to grep utility) then grep will try to find all occurrence of "cat" word (remember grep read word "cat" as the c letter followed by a and followed by t) including cat, copycat, catalog etc.

Pattern defined as:
"Set of characters (may be words or not) is called pattern."
For e.g. "dog", "celeron", "mouse", "ship" etc are all example of pattern. Pattern can be change from one to another, for e.g. "ship" as "sheep".

Metacharacters defined as:
"If patterns are identified using special characters then such special characters are know as metacharacters".

expressions defined as:
"Combination of pattern and metacharacters is know as expressions (regular expressions)."
Regular expressions are used by different Linux utilities like

So you must know how to construct regular expression. In the next part of LSST you will learn how to construct regular expression using ex editor.

For this part of chapter/tutorial create 'demofile' - text file using any text editor.

Finding matching pattern using grep utility
Getting started with ex