Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ grep command Series: grep command to search for multiple words     - MySQL separation Amoeba achieve literacy (Database)

- Oracle Database Performance Optimization of memory disk (Database)

- Oracle 11g partition maintenance (Nice) - Truncating And Partitions (Database)

- How to ensure the Linux SSH login security with one-time password (Linux)

- The development environment to build Nodejs under Ubuntu 14.04 (Linux)

- Linux Getting Started tutorial: build your own Vim (Linux)

- Making Linux root file system problems on-link library (Programming)

- MySQL development common query summary (Database)

- Linux iptables firewall settings whitelist (RHEL 6 and CentOS 7) (Linux)

- Construction of Android and iOS apps use Jenkins Automation (Programming)

- Android screen rotation processing and ProgressDialog the best AsyncTask (Programming)

- Android start automatically and add and delete a desktop shortcut (Programming)

- Linux installation and error under codeblocks exclude [Ubuntu 10.04] (Linux)

- String JavaScript type system (Programming)

- SSL VPN SSL VPN access to security websites patron (Linux)

- ImportTsv-HBase data import tool (Database)

- Transfer MySQL database to MariaDB (Database)

- ASM Management - How to Rename diskgroup (Database)

- Binding unofficial Google Drive and Ubuntu 14.04 LTS (Linux)

- Nagios plugin installation tutorial of Nrpe (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
     
         
         
         
  More:      
 
- Linux character device - a simple character device model (Linux)
- Using 30 seconds to write a detailed analysis of garbage removal system (Linux)
- RedHat virtual machine to install VMware Tools (Linux)
- How to deploy Python Web application: Heroku deployment process complete records (Server)
- How to use the DM-Crypt encryption Linux File System (Linux)
- Oracle GoldenGate encryption (Database)
- Linux disk partition batch format mount script (Linux)
- How to statistical data of various size Redis (Database)
- systemd Power Management (Linux)
- How do you turn on and off IPv6 address on Fedora (Linux)
- Editor of the popular Linux Gvim (Linux)
- C ++ pointer of the (error-prone model) (Programming)
- Percona MySQL 5.6 semi-synchronous replication (Database)
- Linux 64-bit porting (Programming)
- CentOS 6/7 Series Docker Installation (Linux)
- Oracle to create an external table (Database)
- Docker + Nginx + Tomcat7 simple load balancing configuration (Server)
- 30 minutes with your Quick Start MySQL Tutorial (Database)
- To install and deploy Apache under the CentOS (Server)
- Different versions of MongoDB achieve master-slave replication (Database)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.