How to Use egrep to Find Multiple Strings in a File?

Below is the example to find multiple strings in a file using the egrep command in Linux or Unix environment.

egrep Command to Find Multiple Strings in a File

In the following example, the egrep command will look for strings Scott, Smith and Phillip in all text files.
egrep 'Scott|Smith|Phillip' *.txt



To specify a particular file, you can specify the name instead of *.txt. For example:
egrep 'Scott|Smith|Phillip' emp.txt

egrep command example to search multiple patterns in a file in shell.


Popular posts from this blog

How to Subscribe/Unsubscribe CMHK Kabayan 4G/3G Data?

How to Change Password in Toad for Oracle?

How to Kill Session in Toad for Oracle?