<>grep Command introduction

Grep Command line command for searching text strings , There are the following common usage scenarios :

* Search for strings in files (pattern)
* Used with pipes , Other Linux The output of the command is piped to grep
grep The four letters of correspond to the following English :

* G:global search
* RE:regular expression
* P:print out the line
cut Is to put a line of messages , Take out something we want , and grep Is to analyze a line of information , If there is the information we need , Just take out the bank

<> Command format
Find the pattern string in each given file

Commonly used option option :

-a : Search binary files for data in the form of text files
-c : Calculation found ‘ Search string ’ Times of
-i : Ignore case differences , That is, the case is regarded as the same
-n : Output line number by the way
-v : Show the line without pattern string

Common usage scenarios :

<> Whether there is recursive search under the current directory nmsl This string :
grep -r -n nmsl .
<> Use with pipeline command

List the suffixes in the current directory .conf File for
ls | grep *.conf
Output the number of files in the current directory
ls -l | wc -l
<> Use of quotation marks

When matching pattern For words , Quotation marks can be used or not

When matching pattern When string , You must include the string in quotation marks

©2019-2020 Toolsou All rights reserved,
Solve in servlet The Chinese output in is a question mark C String function and character function in language MySQL management 35 A small coup optimization Java performance —— Concise article Seven sorting algorithms (java code ) use Ansible Batch deployment SSH Password free login to remote host according to excel generate create Build table SQL sentence Spring Source code series ( sixteen )Spring merge BeanDefinition Principle of Virtual machine installation Linux course What are the common exception classes ?