The grep command is called global search regular expression (RE) and print out 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 lines.
Syntax:
grep [-acinv] [--color=auto] 'Search String' File Name
Parameter Explanation:
- a : Search the binary file as a text file
-c : Calculate the number of times the 'string to be searched' is found
-i :Ignore the difference between upper and lower case
-n : By the way, output line number
-v : Reverse selection, that is, the line that shows no 'to-be-searched string' content
--color=auto : will find Keyword part plus color display
Example:
Both are demonstrated in server.properties under /bigdata/kafka/kafka_2.11-0.9.0.1/config/
1, find the line with zookeeper from the server.properties file and output
2, find the line with zookeeper from the server.properties file and output, and 1 , display zookeeper in color; 2, display line number
3, find the line with zookeeper from the server.properties file and output, and 1, the zookeeper is displayed in color; 2, display line number; 3, ignore case
or
4, from server.propert Find the line with zookeeper in the ies file, and 1, count the number of occurrences; 2. ignore the case
5. Search for files with 'zookeeper' line in the current directory
6. Search for files with 'zookeeper' line in the current directory and its subdirectories
7. In the current directory Search for files with 'zookeeper' lines in its subdirectories, but do not display matching lines, only show matching files
There are regular expressions, which are waiting to be continued!
As a network operation and maintenance engineer, if you manage more routing and switching d
The following folder on the desktop is shared as a shared folder to the Linux system in the virtual
Liunx shared file server uses samba, so the linux shared server is to set up the samba server; 1, n
What is a process? A process is a running instance of an already launched executable. The process ha
How to upgrade Win10.1 update Win10.1 online upgrade and ISO image upgrade method introduction
Win 7 system security optimization, slimming strategy
What causes the inability to enter Windows XP?
Win10 quick replacement login background image method
Windows10 navigation bar hides the U disk and does not let it display
Win10 Preview 9879: The new application Insider Hub
WinXP/2K: The top ten hiding place for self-starting programs
Win10 Redstone latest preview version 14267 screenshot exposure