Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ grep command Series: grep command to search for multiple words     - Linux Firewall Basics (Linux)

- Using Maven to download Spring (Linux)

- Installation Eduspec university management systems 17 Linux Mint (Server)

- Vi / Vim prompt solutions do not have permission to save time (Linux)

- Linux installation skynet issue summary (Linux)

- tar command to extract a file error: stdin has more than one entry (Linux)

- Security implementation of disk data protection under Linux (Linux)

- Linux daemon (Linux)

- Ubuntu Backup and Recovery (Linux)

- Java thread pool: ExecutorService, Executors (Programming)

- Linux loopback adapter Driven Design (Programming)

- Practical top command (Linux)

- [SHELL] MySQL primary recovery solution from + Keepalived online (Server)

- Install Ubuntu Software Center App Grid (Linux)

- Linux operating system Start Tutorial: Xmanager Remote Access Linux graphical interface (Linux)

- zBackup: A versatile tool to remove duplicate backup (Linux)

- Encounter ORA-00600: internal error code, arguments: [4194] ORA-1552 (Database)

- secureCRT remote login Linux must first open the connection protocol (Linux)

- OpenNMS compile under Linux (Server)

- IO reference Docker container (Server)

 
         
  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:      
 
- The Linux-based security settings Ipchains Firewall (Linux)
- Linux find command detailing (Linux)
- PL / SQL -> UTL_FILE use presentation package (Database)
- After installation of Debian 6.0 do a few things first (Linux)
- Timeout control related to Python threads and a simple application (Programming)
- APT-GET commonly used Linux command (Linux)
- Ubuntu file security removal tool (Linux)
- Xshell key authentication mechanism using a remote login Linux (Linux)
- Java string intern constant pool resolution Introduction (Programming)
- MySQL Statistics (Database)
- Linux Firewall Basics (Linux)
- Java foundation comb: Array (Programming)
- React Native (Programming)
- Use Swift remove the spaces in the string (Programming)
- Google open source TCP team repaired the Linux kernel TCP flaw (Linux)
- Linux dynamic libraries and Guide (Programming)
- Cooling solutions Ubuntu system (Linux)
- Use PuTTY key authentication mechanism for remote login Linux (Linux)
- CentOS 5.5 install ntop (Linux)
- Linux Powerful IDE - Geany configuration instructions (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.