bash – finding files which have one of parent folders with a very specific name, and contain specific sub string

find . -maxdepth 5 -type f -path "*sites-available/*"|xargs egrep -i openid

gives me:
./server0/etc/apache2/sites-available/some.vhost.eu.conf:        DocumentRoot /var/www/openIdKnp/public
./server1/etc/apache2/sites-available/different.vhost.eu.conf:            OIDCRedirectURI https://bla.bla.bla.

and to compress all of the files into single tar archive:

find . -maxdepth 5 -type f -path "*sites-available/*" -exec tar -rvf /tmp/out.tar {} \;

Leave a Reply

Your email address will not be published. Required fields are marked *

(Spamcheck Enabled)