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
Output:
emp.txt:1200|Scott|Technology|5500 emp.txt:9500|Smith|Technology|6000 emp.txt:9548|Phillip|IT|8000
To specify a particular file, you can specify the name instead of *.txt. For example:
egrep 'Scott|Smith|Phillip' emp.txt


Post a Comment