The grep of a Linux command---1

Source: Internet
Author: User

grep means "match"

Parameters commonly used in four

-I matching file contents ignoring case

-R recursive matching files (i.e., files in a layer-level directory)

-N Indicates the line number of the matched row displayed in the file

-h (added by default when using grep alone) displays the file path and file name to match to

--color=auto highlight the matched string in the matched row

General use:

Grep-irnh or Grep-irn

Grep-irnh "Line" *//starting with the string in this level directory or from the directory contained in this level directory and displaying the row number of the document in which it is located

Grep-irnh--color=auto "Line" *//start matching and highlighting the string from this level directory or from the directory contained in this level directory and display the row number of the document in which it is located.

------------------------------Correlation Matching Find--------------------

Using find to implement a match

Find. -name "*.ctl"-print |xargs grep "line"//"." Indicates that this level directory-name represents a document that ends with a CTL, and then matches the line string in the contents of these documents and prints it on the screen

The grep of a Linux command---1

Related Article

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.