Linux rgrep command details how to use the Linux rgrep command

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.