Latest web development tutorials

Linuxのegrepのコマンド

Linuxのegrepのコマンド

LinuxのコマンドDaquanの LinuxのコマンドDaquanの

Linuxのegrepのコマンドは、ファイル内の指定した文字列を検索するために使用されます。

egrepの結果の実装と「grepの-E "はgrepが、その解釈の文字列とは異なり、構文とgrepコマンドを参照するために使用されるパラメータに似ています。

egrepのは、解釈するために、正規表現の構文を拡張してから、基本的な正規表現の表現よりも標準化された基本的な正規表現の構文、拡張正規表現を解釈するのgrepを使用しています。

文法

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

パラメータ説明:

  • [テンプレートモード]:検索文字列ルール。
  • [ファイルまたはディレクトリ]:対象のファイルまたはディレクトリを検索します。

文字の条件を満たしているファイルを表示します。 たとえば、文字列の「Linux」が含まれている現在のディレクトリ内のすべてのファイルを検索するには、次のコマンドを使用することができます。

egrep Linux *

結果は以下の通りであります:

$ 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のコマンドDaquanの LinuxのコマンドDaquanの