Re: To have find to not print, ie. to supress, when a condition

Bernhard Voelker <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs,gmane.comp.gnu.coreutils.general
Message-ID <[email protected]>
On 12/12/20 4:56 AM, Budi wrote:
> How do we have find to not print, ie. to supress, when on else condition ?
> 
> find .  -path '*/*t*s' \( -type d -printf "DIR:%p\n" -o -printf "**%p**\n" \) -o -print
>                                                                       --------^
> 
> The pointed out by arrow alternative  -printf "**%p**\n" is intended
> to be instructing to suppress it instead"
> 
> How to solve it as if it's omitted altogether it'll be printed out?
> Thanks before

First of all: you reached to GNU coreutils mailing list where the discussions are about
tools like cp, mv, tail etc., but not about find which is in the separate GNU findutils
package.  Thus, I'm there adding their mailing list.

From the command line show above, it's not really clear to me what you want
to achieve or where the problem is.  I mean if you don't want the final "-o -print"
to print something, then why don't you just omit it from the command line?
This seems to work just fine (depending on what you want to achieve):

  find .  -path '*/*t*s' \( -type d -printf "DIR:%p\n" -o -printf "**%p**\n" \)

Regarding an "else condition", it might be worth reading about '-prune' in the
GNU findutils documentation.

Have a nice day,
Berny
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.