bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Bernhard Voelker
Subject: Re: To have find to not print, ie. to supress, when a condition
Date: Sat, 12 Dec 2020 14:02:12 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]