OR operator for Grep

For grep expressions the OR operator is “|”. Here is an example using tail on a file looking for 2 strings occurrences:

tail -f /var/log/apache2/error.log | grep "PHP Notice\|client denied"

or another example to list the content of the php.ini file without comments and empty lines:

grep -v "^#\|^$\|^;" /etc/php5/apache2/php.ini
comments powered by Disqus