Text processing
8 mingrep, and which regular expression
Basic and extended patterns are backwards from each other.
grep prints the lines that match, and its exit status is the answer when you do not want the lines: 0 matched, 1 did not, 2 something went wrong.
The pattern is a regular expression, not a glob. . matches any character and * means 'zero or more of the previous thing' — the opposite of what a glob's * means.
Try this
In a basic regular expression — the default — +, ?, |, ( and ) are ordinary characters, and their escaped forms are the operators. In an extended one, reached with -E, it is the other way round.
This is backwards from every other regular-expression dialect, which is why grep -E is usually the one you want.
Try this
$
Files
| Mode | Links | Size | Name |
|---|---|---|---|
| -rw-r--r-- | 1 | 1602 | app.log |
| -rw-r--r-- | 1 | 394 | app.log.1 |