There are cases where you search for files that contain a specific string or term. That is when Linux utilities such as grep or egrep can help. What if you are looking for files that must match more than one string? Here is a quick run down on how you can use grep or egrep to match multiple strings.
To grep for files that contain any of multiple keywords:
To grep for files that contain all multiple keywords:
To grep for files that contain multiple words (without any order) in one line:
To grep for files that contain multiple ordered words in one line:
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!
Latest posts by Dan Nanni (see all)
- How to back up a WordPress website to remote cloud storage from the Linux command line - November 24, 2015
- How to access Dropbox from the command line in Linux - November 22, 2015
- How to send email notifications using Gmail SMTP server on Linux - November 9, 2015