Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ grep command Series: grep command to search for multiple words     - Ubuntu 15.10 15.04 14.10 14.04 Install Ubuntu Tweak (Linux)

- Java objects to garbage collection (Programming)

- Use the dd command to the hard disk I / O performance test (Linux)

- Haproxy multi-domain certificate HTTPS (Server)

- AngularJS (Programming)

- How wifi-linux AP signal strength detection (Linux)

- Solve ORA-01012: not logged on (Database)

- The strings in Python reside (Programming)

- Fedora 22 installation and configuration optimization (Linux)

- Linux environment to build next Cocos2dx-3.3.1 (Linux)

- MySQL and MariaDB traditional master-slave cluster configuration (Database)

- To disable the function by pressing Ctrl-Alt-Del to restart the system in RHEL / CentOS 5/6 (Linux)

- Use mysqldump MySQL database backup - Linux Shell Scripting (Database)

- MongoDB Study Notes (1) - Install MongoDB on Windows systems (Database)

- Mounting kit under Fedora Linux (Linux)

- Setting Wetty do not need an account login command line operations (Linux)

- Git 2.5 increase in the working tree, triangle improved workflow performance (Linux)

- Implement binary search algorithm in C language (Programming)

- Fast Learning Clojure (Programming)

- Installation Enpass secure password manager on Ubuntu (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
- PostgreSQL with the C Completing the storage process instances (Database)
- Create several practical points of high security PHP site (Linux)
- Linux system server network security management tips (Linux)
- Ubuntu is expected to allow you to install the latest Nvidia Linux drivers easier (Linux)
- php performance monitoring module XHProf (Linux)
- CentOS 6.5 can not connect to the network under VMware (Linux)
- VSFTPD Security (Linux)
- Use Markdown editor for document work under Linux (Linux)
- findmnt- Looking mounted file system (Linux)
- VMware virtual machine to install CentOS 7 (Linux)
- Ease of use "Explain Shell" script to understand Shell command (Linux)
- HAProxy performance under high concurrency (Server)
- Linux file system data file deletion problem space is not freed (Database)
- CentOS 6.4 installation environment to build Scrapy 0.22 (Linux)
- Linux Network Programming - raw socket programming (Programming)
- CentOS iptables firewall configuration (Linux)
- VMware virtual machine to use bridged mode fast Internet access (Linux)
- CentOS terminal display Chinese (Linux)
- Ubuntu uses under KVM + Qemu virtual machine build (Linux)
- System Security: Build Linux with LIDS steel castle (Linux)
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.