Latest web development tutorials

Linux rgrep command

Linux command Daquan Linux command Daquan

Linux rgrep command recursively find files that match the criteria string.

Similar rgrep command functions and grep command, you can find content that contains the specified template style file, if you find the content of a file conforms to the specified style templates, preset rgrep instruction will contain the row style template is displayed.

grammar

rgrep [-?BcDFhHilnNrv][-R<范本样式>][-W<列长度>][-x<扩展名>][--help][--version][范本样式][文件或目录...]

Parameter Description Number:

  • -? Display style templates and examples described below.
  • -B Ignore binary data.
  • -c calculated in line with the number of columns template styles.
  • -D Debug mode, only a list of instructions listed in the directory search, and does not read the contents of the file.
  • -F When faced with symbolic links, rgrep default is not ignored, the addition of this parameter, rgrep instruction will read the contents of the connection points to the original file.
  • -h will meet the special string template style marked.
  • -H Only lists a string in template style, rather than the entire contents of the column display.
  • -i Ignore character case differences.
  • -l lists the file contents of the file name matches the specified template style.
  • -n before displaying the row in line with the style of the Square, marking the number of columns number of the column.
  • -N Do not recursive processing.
  • -r recursive processing, all files and subdirectories in the specified directory be dealt with.
  • -R <Style template> similar effect and specify this parameter "-r" parameter, but only in line with the main document templates style file names.
  • -v reverse lookup.
  • -W <Column length> Limits column where the string template in line with the style, the number of characters must have.
  • -x <extension> deal only meet the specified file name extension file.
  • --help online help.
  • --version display version information.

Examples

Find the file that contains the sentence "Hello" string in the current directory, use the following command:

rgrep Hello * 

Its search results are as follows:

$ rgrep Hello *             #在当前目录下查找句子中包含“Hello”字符串的文件  
testfile_1:Hello 95         #testfile_1中包含“Hello”字符串的句子  
testfile_2:Hello 2005       #testfile_2中包含“Hello”字符串的句子 

Linux command Daquan Linux command Daquan