Hey all, I'm trying to do a find of all files with the phrase 'varnish' in the name, but want to exclude a user home directory called /usr/local/digitalplatform. Here's what I was able to come up with: find / -path '/usr/local/digitalplatform/*' -prune -o -name "*varnish*" Which results in this: [root at uszmpwsls014lb ~]# find / -path '/usr/local/digitalplatform/*' -prune -o -name "*varnish*" | grep digitalplatform /usr/local/digitalplatform/.bash_logout /usr/local/digitalplatform/varnish-2.1.5.tar.gz /usr/local/digitalplatform/.viminfo /usr/local/digitalplatform/.ssh /usr/local/digitalplatform/varnish-1360.tar.gz /usr/local/digitalplatform/.emacs /usr/local/digitalplatform/varnishncsa-init /usr/local/digitalplatform/varnish-sysconfig-stg /usr/local/digitalplatform/memcached-1.4.7.tar.gz /usr/local/digitalplatform/.bash_profile /usr/local/digitalplatform/.mozilla /usr/local/digitalplatform/.subversion /usr/local/digitalplatform/.bashrc /usr/local/digitalplatform/.zshrc /usr/local/digitalplatform/varnish-sysconfig /usr/local/digitalplatform/default.vcl /usr/local/digitalplatform/1360-apache-stage.tar.gz /usr/local/digitalplatform/.bash_history /usr/local/digitalplatform/memcached-1.4.7 /usr/local/digitalplatform/httpd.conf /usr/local/digitalplatform/varnish-2.1.5 /usr/local/digitalplatform/varnish_reload_vcl /usr/local/digitalplatform/varnish-prod.tar.gz /usr/local/digitalplatform/varnish-init /usr/local/digitalplatform/1360-stage-apache.tar.gz I'd like to know what I'm doing wrong, and how I can best achieve the desired results? Thanks Tim -- GPG me!! gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
Just grep it out. find . -print | grep -v digitalplatform -v excludes On Sun, May 11, 2014 at 11:33 AM, Tim Dunphy <bluethundr at gmail.com> wrote:> Hey all, > > I'm trying to do a find of all files with the phrase 'varnish' in the > name, but want to exclude a user home directory called > /usr/local/digitalplatform. > > Here's what I was able to come up with: > > find / -path '/usr/local/digitalplatform/*' -prune -o -name "*varnish*" > > Which results in this: > > [root at uszmpwsls014lb ~]# find / -path '/usr/local/digitalplatform/*' -prune > -o -name "*varnish*" | grep digitalplatform > /usr/local/digitalplatform/.bash_logout > /usr/local/digitalplatform/varnish-2.1.5.tar.gz > /usr/local/digitalplatform/.viminfo > /usr/local/digitalplatform/.ssh > /usr/local/digitalplatform/varnish-1360.tar.gz > /usr/local/digitalplatform/.emacs > /usr/local/digitalplatform/varnishncsa-init > /usr/local/digitalplatform/varnish-sysconfig-stg > /usr/local/digitalplatform/memcached-1.4.7.tar.gz > /usr/local/digitalplatform/.bash_profile > /usr/local/digitalplatform/.mozilla > /usr/local/digitalplatform/.subversion > /usr/local/digitalplatform/.bashrc > /usr/local/digitalplatform/.zshrc > /usr/local/digitalplatform/varnish-sysconfig > /usr/local/digitalplatform/default.vcl > /usr/local/digitalplatform/1360-apache-stage.tar.gz > /usr/local/digitalplatform/.bash_history > /usr/local/digitalplatform/memcached-1.4.7 > /usr/local/digitalplatform/httpd.conf > /usr/local/digitalplatform/varnish-2.1.5 > /usr/local/digitalplatform/varnish_reload_vcl > /usr/local/digitalplatform/varnish-prod.tar.gz > /usr/local/digitalplatform/varnish-init > /usr/local/digitalplatform/1360-stage-apache.tar.gz > > > I'd like to know what I'm doing wrong, and how I can best achieve the > desired results? > > Thanks > Tim > > > > -- > GPG me!! > > gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos-- ----------------- Hal Wigoda Chicago
On Sun, 2014-05-11 at 12:33 -0400, Tim Dunphy wrote:> Hey all, > > I'm trying to do a find of all files with the phrase 'varnish' in the > name, but want to exclude a user home directory called > /usr/local/digitalplatform.find / -path /usr/local/digitalplatform -prune -name \*varnish\* doesn't work?
On Sun, May 11, 2014 at 12:33:47PM -0400, Tim Dunphy wrote:> find / -path '/usr/local/digitalplatform/*' -prune -o -name "*varnish*"Try find / -path /usr/local/digitalplatform -prune -o name '*varnish*' -print Without the explicit -print, find will implicitly add one e.g find / \( -path .... -o -name ... \) -print -- rgds Stephen