May 2000
Beginner
761 pages
18h 20m
English
A regular expression to awk is a pattern that consists of characters enclosed in forward slashes. Awk supports the use of regular expression metacharacters (same as egrep) to modify the regular expression in some way. If a string in the input line is matched by the regular expression, the resulting condition is true, and any actions associated with the expression are executed. If no action is specified and an input line is matched by the regular expression, the record is printed. See Table 5.6.
% awk '/Mary/' employees Mary Adams 5346 11/4/63 28765 |
Explanation
Awk will display all lines in the employees file containing the regular expression pattern Mary.
% awk '/Mary/{print $1, $2}' ... |
Read now
Unlock full access