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