Commonly Used Regular Expressions
Search for a specific string Use dmesg to list the core information and then use grep to find out which line contains " tap" , and to color the captured keywords, and add the line number to indicate: dmesg -a | grep -n --color=auto 'tap' The first two lines and the last three lines of the line where the keyword is located are also captured and displayed: dmesg -a | grep -n -A3 -B2 --color=auto 'tap' dmesg is a command on most Unix-like operating systems that prints the message buffer of the kernel. The output includes messages produced by the device drivers. Suppose we want to get the specific string "abc" from the file just now, the easiest way is like this: grep -n 'abc' regular_express.txt -n Show line number. I want to display the line where the string abc is a specific ignoring case: grep -in 'abc' regular_express.txt -i Ignore case. What we want is that the line does not have the string "abc" to be d...