Find Documents
It is quite convenient to find text in the grep program (matching text matching). There are traditionally three programs that can be used to find entire text files.
- grep's oldest text-matching program. The simplest way is to use a fixed string
$ The Who |grep-f Austen //example uses the-F option to find the fixed string Austen.
In fact, as long as the matching pattern does not contain the meta character (metacharacter) of the regular expression, the grep default behavior pattern is equivalent to the use of-F.
$ who |grep Austen
- Egrep extended grep. This program uses extended regular expressions--a set of more powerful regular expressions, and the cost of using it is good dick more computing resources.
- Fgrep Quick grep (fast grep). This version matches a fixed string instead of a regular expression, and it uses an optimized algorithm that can more effectively match a fixed string.
Regular expressions
A regular expression is a representation that lets you find text that matches a specific criterion. This notation allows you to write an expression that selects or matches multiple data strings.
In addition to the traditional UNIX regular expressions, POSIX regular expressions can do the following:
- Write a regular expression that represents locale-specific sequence order and equivalent characters
- Write regular expressions without having to worry about what the system's underlying character set is.
Shell Review notes----Find and replace