The rgrep command is similar to the grep command. You can find files whose content contains the specified template style. If you find that the content of a file conforms to the specified template style, the default rgrep command displays the column containing the template style.
Syntax
Rgrep [-? BcDFhHilnNrv] [-R <Template style>] [-W <column length>] [-x <extension>] [-- help] [-- version] [template style]
[File or directory...]
Parameter description:
-? Displays the template style and example descriptions.
-B ignores binary data.
-C: calculate the number of columns that conform to the template style.
-D troubleshooting mode: only lists the directories searched by commands without reading the file content.
-F when a symbolic connection is encountered, rgrep ignores and does not process it by default. After this parameter is added, the rgrep command reads the content of the original file to which the connection points.
-H indicates strings that conform to the template style.
-H: only lists strings that conform to the template style, rather than displaying the entire column.
-I ignores the differences in case sensitivity.
-L list the names of objects whose contents match the specified template style.
-N indicates the number of columns in the column before displaying the column that conforms to the square style.
-N: do not perform recursive processing.
-R recursive processing: All files and subdirectories in the specified directory are processed together.
-R
<Template style> the effect of this parameter is similar to that of the specified "-r" parameter, but only the files that match the name of the template style file are used.
-V reverse lookup.
-W
<Column length> restrict the number of characters required for a string that meets the template style.
-X
<Extension> only files with the specified extension are processed.
-- Help online help.
-- Version: displays the version information.
Instance
Find the file containing the "Hello" string in the current directory, and run the following command:
Rgrep Hello *
The search result is as follows:
$ Rgrep Hello * # search for files containing the "Hello" string in the current directory
Testfile_1: Hello 95 # sentences containing the "Hello" string in testfile_1
Testfile_2: Hello 2005 # sentences containing the "Hello" string in testfile_2