English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Linux egrep command is used to search for specified strings within a file.
The execution effect of egrep is similar to "grep-Similar to E"grep, the syntax and parameters can be referred to as grep commands, and the difference lies in the method of interpreting strings.
egrep is interpreted using the extended regular expression syntax, while grep uses the basic regular expression syntax. Extended regular expressions are more standardized than basic regular expressions.
egrep [Pattern] [File or Directory]
Parameter description:
[Pattern] : The rule of the string to be searched.
[File or Directory] : The target file or directory to be searched.
Display characters that meet the conditions in the file. For example, to find all files containing the string "Linux" in the current directory, you can use the following command:
egrep Linux *
Results as shown below:
$ egrep Linux * #Find files in the current directory containing the string “Linux” testfile:hello Linux! #The following five lines are testfile containing Linux characters testfile:Linux is a free Unix-type operating system. testfile:This is a Linux testfile! testfile:Linux testfile:Linux testfile1:helLinux! #The following two lines are testfile1Line containing Linux characters testfile1:This a Linux testfile! #The following two lines are testfile_2 Line containing Linux characters testfile_2:Linux is a free unix-type operating system. testfile_2:Linux test xx00:hello Linux! #xx00 contains Linux characters xx01:Linux is a free Unix-type operating system. #The following three lines are xx01Line containing Linux characters xx01:This is a Linux testfile! xx01:Linux