Egrep function description: the egrep command and the grep command have the-E flag, except for the difference in the error message and the use of the message and the function of the-s flag. Use the egrep command to search for one or more files. the prompt can be an extension rule expression symbol. the extension rule expression symbol includes the rule expression symbol. some special symbols are added on the basis of the grep command. | ---------- | Symbol | meaning | egrep
Function description:The egrep command is the same as the grep command with the-E flag, except for the difference between the error message and the use of the message and the function of the-s flag. Use the egrep command to search for one or more files. the prompt can be an extension rule expression symbol. the extension rule expression symbol, including the rule expression symbol, adds some
Special symbol.
| ---------- |
| Symbol | meaning |
| ---------- |
+: Indicates that one or more previous characters are repeated.
? : Represents the first character of zero or more
|: Indicates OR. If either of them meets the conditions.
(): Indicates the residential group, indicating that you only need to find the group in (). the content in the group can be separated by (|.
() +: Identifies duplicate groups. That is, you only need to match the content of one or more groups. And! Extended Regular expressions do not express special characters, so they can be used as common characters as an excuse.
.: Represents any character.
Instance used:
(1)
[Root @ LiWenTong test4] # egrep 'n' (e | o) + '/etc/passwd à if there is Ne in Wendan management, all start with NO will be matched.
Nobody: x: 99: 99: Nobody: // sbin/nologin
(2) search for rows that contain network admin or uucp admin
[Root @ LiWenTong test4] # egrep '(network | uucp)'/etc/passwd
Uucp: x: 10: 14: uucp:/var/spool/uucp:/sbin/nologin
(3) search for rows without digits
[Root @ linux-lwt tmp] # egrep '^ [^ 0-9] + $' 1.txt
AsdfasfEASDF
See http://www.cnblogs.com/ggjucheng/archive/2013/01/13/2856896.html
--------------------------- Subsequent personal Summary -------------------
Compared with the grep regular expression, egrep adds the Dot regular expression. For example, | or. + Repeat one or more previous characters .? Repeat 0 or more previous characters. The usage is also the same, basically for the line, can be well implemented. It depends on whether we can use it flexibly.