简体   繁体   中英

How can I “clip” the output of the find command?

I executed the following command:

find / -type f -name fs-type -exec svnlook tree {} \; |egrep "/$" 

The result was

svnlook: Can't open file '/var/lib/svn/repos/b1me/products/payone/generic/code/core/db/fs-type/format': Not a directory 
svnlook: Can't open file '/var/lib/svn/repos/b1me/products/payone/generic/code/fees/db/fs-type/format': Not a directory

Maybe I should make find command give me the path without db/fs-type/format in other words I should clip the output of find . How can I do this?

First you can give

find ... -not -path "*/db/*"

to find.

This is what you're looking for

find Subversion -type d -name db -exec svnlook tree {}/.. \; | egrep "/$"

Your command was failing because svnlook expects a directory argument not a file one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM