The grep command in a Linux system is a powerful text search tool that uses regular expressions to search for text and print matching rows. This command is often used to parse a line of information, if it has the information we need, to display the line, which is usually used with the pipe command, to filter the output of some commands, and so on, and its simple syntax is:
grep [-ACINV] [--color=auto] ' find string ' filename
Options and Parameters:
-A: Find data in text file as binary file
-C: Calculates the number of find ' Find string '
-I: Ignore case difference, that is, the case is treated as the same
-V: Reverse selection, which shows the line with no ' find string ' content
-N: By the way output line number
--color=auto: Can be found in the keyword part of the color display
For example:
1.
2. Displays all the lines that contain w in a file that starts with P.
3. Displays the rows that match wh in the Hellob.txt,pear.txt file.