Latest web development tutorials

Linux egrep Command

Linux egrep Command

Linux command Daquan Linux command Daquan

Linux egrep command is used to find the specified string within the file.

egrep implementation of the results and "grep-E" is similar to the syntax and parameters used to refer grep command, grep differs from that interpretation strings.

egrep is extended regular expression syntax to interpret, and then use grep interpret basic regular expression syntax, extended regular expression more standardized than the expression of basic regular expression.

grammar

egrep [范本模式] [文件或目录] 

Parameter Description:

  • [Template Mode]: the search string rules.
  • [File or directory]: Find the target file or directory.

Examples

Display files that meet the conditions of the characters. For example, to find all files in the current directory that contain the string "Linux", you can use the following command:

egrep Linux *

The results are as follows:

$ egrep Linux * #查找当前目录下包含字符串“Linux”的文件  
testfile:hello Linux! #以下五行为testfile 中包含Linux字符的行  
testfile:Linux is a free Unix-type operating system.  
testfile:This is a Linux testfile!  
testfile:Linux  
testfile:Linux  
testfile1:helLinux! #以下两行为testfile1中含Linux字符的行  
testfile1:This a Linux testfile!  
#以下两行为testfile_2 中包含Linux字符的行  
testfile_2:Linux is a free unix-type opterating system.  
testfile_2:Linux test  
xx00:hello Linux! #xx00包含Linux字符的行  
xx01:Linux is a free Unix-type operating system. #以下三行为xx01包含Linux字符的行  
xx01:This is a Linux testfile!  
xx01:Linux 

Linux command Daquan Linux command Daquan