Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ grep command Series: grep command to search for multiple words     - Apache Tomcat integration and resin (Server)

- Java static code analysis tool Infer (Programming)

- HTML5 postMessage cross-domain data exchange (Programming)

- Ubuntu and Derivatives users install the latest KKEdit 0.0.31 (Linux)

- Linux SVN account password to save your settings (Linux)

- 10 easy to use Linux utilities Recommended (Linux)

- Java foundation comb: Array (Programming)

- Oracle 11R2 Grid Infrastructure execute root.sh script rootcrs.pl execution failed treatment (Database)

- Running the open-source Swift under Linux platform (Linux)

- Ubuntu user use PPA to install Uget 2.0.5 (Linux)

- Linux see whether there is a hacker program (Linux)

- Rely on IP chain established Linux firewall (Linux)

- pscp use Detailed Windows and Linux each file transfer tool (Linux)

- Piostat - Monitoring and Statistics Linux process (Linux)

- Kali Linux virtualbox rc = Error 1908 workaround (Linux)

- After CentOS configure SSH password Free, still prompted for a password (Linux)

- CoreOS use register mirror to build private warehouse (Linux)

- How to build a custom exclusive Ubuntu Live CD (Linux)

- SQL Beginner Guide (Database)

- Based on OpenSSL for HTTPS service configuration (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
- Not safe procedure under Linux (Linux)
- Installation Docker FAQ on Ubuntu (Linux)
- To explore the Android ListView caching mechanism again (Programming)
- Getting Started with Linux system to learn: How do I know which processes are running on the CPU core (Linux)
- Install Mac OS X 10.9 systems VMware10 (Linux)
- lack of SWAP space during installation of Oracle (Database)
- Arduino UNO simulation development environment set up and run simulation (Linux)
- PHP with FastCGI and mod_php Comments (Server)
- Ubuntu root user profiles (Programming)
- Installation and management of Linux applications (Linux)
- Upgrade installation manual CentOS6.5 GCC4.8.2 (Linux)
- Java programmers talk about those advanced knowledge and direction (Programming)
- ActiveMQ5.10.2 version configuration JMX (Linux)
- GCC and gfortran write MEX program (Matlab2012a) under Ubuntu 14.04 (Programming)
- [Errno 4] IOError: [Errno ftp error] with yum appears as a workaround (Linux)
- Ubuntu Linux use ufw or iptables firewall configuration (Linux)
- Valgrind * not * leak check tool (Linux)
- Editor of the popular Linux Gvim (Linux)
- Add your own kernel and ramfs based on an existing Linux LiveCD (Linux)
- How to install Gnome 3.10 in Ubuntu 13.10 (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.