Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ grep command Series: grep command to search for multiple words     - ORA-30926 and MERGE tables empty the temporary occupation problem (Database)

- Repair after installing Ubuntu no boot device error (Linux)

- MySQL group_con cat_max_Len (Database)

- Linux command execution order control and pipeline (Linux)

- Several reasons MySQL garbled (Database)

- SSH configuration under Linux (Linux)

- Use matplotlib scientific drawing in Linux (Linux)

- To install and deploy Java applications under CentOS 6.5 (Linux)

- Spark read more HBase tables a RDD (Server)

- Docker ecosystem security is gradually maturing (Server)

- C / C ++ language usage summary of const (Programming)

- About enhanced Linux / Unix server system security program (Linux)

- Android realize RippleEffect water (Programming)

- Java Set and List in the relationship and difference (Programming)

- File encryption and decryption of Linux security mechanisms (Linux)

- Orabbix binding Python send graphical reports (Linux)

- Android using SVG vector graphics to create cool animation effects (Programming)

- MySQL multi-master multi-cluster deployment uses alive Galera (Database)

- Create a custom pixel format based on an existing image data BufferedImage (Programming)

- Linux --- process handle limit summary (Linux)

  grep command Series: grep command to search for multiple words
  Add Date : 2018-11-21      
  To use the grep command to search for multiple strings or words, how do we do? For example, I want to find / path / to / file file word1, word2, word3 and other words, how do I look like grep command these words are there?

grep command supports regular expression pattern matching. To use multi-word search, please use the following syntax:

grep 'word1 \ | word2 \ | word3 ' / path / to / file
Under the example, to find a name in / var / log / messages log file in a text warning, error and critical these few words, enter:

$ Grep 'warning \ | error \ | critical ' / var / log / messages
Just to match the word (that is, both sides of the word is a word delimiter, separated by spaces for the West in terms of language), you can add -w option parameter:

$ Grep -w 'warning \ | error \ | critical ' / var / log / messages
egrep command can skip the above syntax, the use of syntax is as follows:

$ Egrep -w 'warning | error | critical ' / var / log / messages
I built the righteous of you add -i (ignore case) and --color option parameters, as shown here:

$ Egrep -wi --color 'warning | error | critical' / var / log / messages

Fig.01: Linux / Unix egrep Command Search Multiple Words Demo Output
- LVS + Keepalived the DR mode (Server)
- Five Linux user space debugging tool (Linux)
- Sorting Algorithm (1) Quick Sort C ++ implementation (Programming)
- MySQL binlog group to submit XA (two-phase commit) (Database)
- The method to mount the CD under Linux (Linux)
- innodb storage engine backup tool --Xtrabackup (Database)
- Oracle creates split and splitstr functions (Database)
- Oracle 11g R2 RAC RMAN backup script example (Database)
- Protect your files, modify the Linux value Umask (Linux)
- Build RPM package uses Docker mirror (Linux)
- Ubuntu 14.10 How to install office suite Calligra Suite 2.8.7 (Linux)
- Zabbix system email alert Python script (Server)
- The AWK use Cygwin tools mysql binlog log viewer (Database)
- Linux kernel RCU (Read Copy Update) lock Brief (Linux)
- The oh-my-zsh into true my zsh (Linux)
- Ubuntu install Lighttpd + Mono support .net (Linux)
- Python context managers (Programming)
- Five kinds of IO Model under Linux (Programming)
- CentOS 5.11 Open VNC access (Linux)
- Oracle 11g RAC automatically play GI PSU patch ( (Database)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.