Linux grep command
The grep command is called global search regular expression (RE) and print out the line, that is, to fully search the regular expression and print the row. It can use regular expressions to search for text and print matched rows.
Syntax:
Grep [-acinv] [-- color = auto] 'Waiting for string' file name
Parameter description:
-A: searches binary files for data using text files.
-C: calculates the number of times the 'string to be searched 'is found.
-I: case insensitive
-N: returns the row number by the way.
-V: reverse selection, that is, the row without the 'string to be searched 'content is displayed.
-- Color = auto: adds the keyword to the color display.
Example:
Server. properties in/bigdata/kafka/kafka_2.11-0.9.0.1/config/
1. Find the row with zookeeper from the server. properties file and Output
2. Search for and output the row with zookeeper from the server. properties file. 1. Display zookeeper in color; 2. display the row number.
3. Search for and output rows with zookeeper from the server. properties file. 1. Display zookeeper in color; 2. Display row numbers; 3. Ignore case sensitivity.
Or
4. Search for rows with zookeeper from the server. properties file. 1. count the number of occurrences. 2. Ignore case sensitivity.
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 'rows in the current directory and Its subdirectories, but do not display matching rows. Only matching files are displayed.
There is also a regular expression, which is not to be continued!