Linux grep command

Source: Internet
Author: User
Tags zookeeper

The grep command is all called Global search Regular expression (RE) and print out of the line, which is a comprehensive search for regular expressions and prints the lines. It can use regular expressions to search for text and print out matching rows.


Grammar:

grep [-ACINV] [--color=auto] ' search string ' file name


Parameter explanation:

-A: binary files are searched for data in the form of a text file

-C: Calculates the number of times to find the ' pending string '

-I: Ignore different case

-N: Output line number by the way

-V: Reverse selection, that is, the line that shows no ' search string ' content

--color=auto: Add a color display to the Found keywords section


Example:

are demonstrated in the server.properties under/bigdata/kafka/kafka_2.11-0.9.0.1/config/

1. Find rows with zookeeper from the Server.properties file and output


2, from the Server.properties file to find the line with zookeeper and output, and 1, will be zookeeper color display; 2, display line number


3, from the Server.properties file to find the line with zookeeper and output, and 1, will be zookeeper color display, 2, display line number; 3, ignore case


Or


4. Find rows with zookeeper from the Server.properties file, and 1, count occurrences; 2, ignore case


5. Search for files with ' zookeeper ' in the current directory


6. Search for files with ' zookeeper ' in the current directory and its subdirectories



7. Search for files with ' zookeeper ' in the current directory and their subdirectories, but do not display matching rows, only matching files are displayed



There are regular expressions, not to be continued!

Linux grep command

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.