Regular expressions are combinations of text and symbols that you can use to search for special configurations of column values. For example, the regular expression `Hello' searches for a value that begins with Hello. When using a regular expression in the command line, be sure to enclose it in quotes, since many of the regular expression symbols have special meaning to the Bourne and C shells. For example:
rootmaster% nisgrep -h greeting='Hello' phrases.doc.com. |
The regular expression symbols are summarized in Table 14-7, below.
Table 14-7 Regular Expression Symbols
Symbol |
Description |
---|---|
^string |
Find a value that begins with string. |
string $ |
Find a value that ends with string. |
. |
Find a value that has a number characters equal to the number of periods. |
[chars] |
Find a value that contains any of the characters in the brackets. |
*expr |
Find a value that has zero or more matches of the expr. |
+ |
Find something that appears one or more times. |
? |
Find any value. |
\'s-char' |
Find a special character, such as ? or $. |
x | y |
Find a character that is either x or y. |