Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ grep command Series: grep command to search for multiple words     - Oracle table of nested loop connection (Database)

- Ubuntu 14.04 installed VirtualBox 4.3 appears vboxdrv: Unknown symbol mcount (Linux)

- Iptables principle (Linux)

- tar decompression problems gzip: stdin: not in gzip format (Linux)

- OpenSSH version smooth upgrade method (Linux)

- Ubuntu15 core CLR (Server)

- Linux network security strategy (Linux)

- Upgrading to MySQL 5.7 partitioning problem solving (Database)

- Cobbler remotely install CentOS system (Linux)

- Linux vi command list (Linux)

- After the first remote installation GlassFish Web to remotely access their back office management system error solution appears (Server)

- Ubuntu Install OpenSSL (Linux)

- Four Methods of Self - Learning Linux (Linux)

- ORA-4031 error Solution (Database)

- Ubuntu installation 2.10.x version of Scala (Linux)

- Detailed installation OpenCV2.3.1 under CentOS 6.5 (Linux)

- Linux netstat command to get started (Linux)

- Ubuntu 14.10 installation GNOME 3.14 (Linux)

- Use SVN to automatically deploy code under Apache (Server)

- Report generation CPU, memory, and input and output ports with the sar command (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:      
 
- KVM usb passthrough configuration (Linux)
- C ++ Learning Notes: references (Programming)
- Analysis of Java keyword final (Programming)
- Based kubernetes Construction Docker Cluster Management Comments (Server)
- PostgreSQL use pgpool achieve high availability (Database)
- Availability Hadoop platform - Oozie Workflow (Server)
- Installation of Python2.7.8 and iPython under CentOS6.5 (Linux)
- The ORA-01113 error is handled with BBED without archiving (Database)
- echo command (Linux)
- Linux System Getting Started Learning: The Linux ac command (Linux)
- Use Redis as time-series database: why and how (Database)
- Linux Getting Started tutorial: Ubuntu 14.04 in the installation Sogou Pinyin (Linux)
- CentOS6 installed Tomcat (Server)
- Justniffer installed on Ubuntu 15.04 (Linux)
- Linux System Getting Started Tutorial: Installing Brother printer in Linux (Linux)
- Encrypted with GnuPG signature to verify the authenticity and integrity of downloaded file (Linux)
- Configuring a Linux operating system against syn attack (Linux)
- awk variables (Linux)
- Use NTFS-3G to mount NTFS partitions under Linux U disk and removable hard disk (Linux)
- Linux folder and extract the differential file comparison techniques -rsync Magical (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.